Viscery

API

Coding with Viscery

To create your ideas with Viscery, you need to know it's base functions. In this page, you will learn them with also their additional features.

Creating GUIs in the Same Addon as Viscery's Addon

When you create GUIs in the same addon as Viscery, you must start coding at last lines to get all of functions.

You get to code with a cleaner syntax when you use the same addon as Viscery:

Example Code

-- ...

local label = visc "TextLabel" {
    Text = "Hello, World!",
    Size = UDim2.new(0.35, 0, 0.15, 0),
    Position = UDim2.new(0.5, 0, 0.5, 0),
    TextScaled = true
}

local screen = display {
    Parent = "ScreenPart",
    Face = "Top"
}

writeParent {
    Parent = screen,
    Item = label
}

This code creates an UI to the part called "ScreenPart" and creates a text label saying "Hello, World!" in the UI.

Using signalAsync Function of SCP: Roleplay

You can use signalAsync function from other addons to use Viscery from anywhere. The thing is that syntax changes a little bit as we use signalAsync everywhere.

Example Code

local label = signalAsync("visc") {
    className = "TextLabel",
    props = {
        Text = "Hello, World!",
        Size = UDim2.new(0.35, 0, 0.15, 0),
        Position = UDim2.new(0.5, 0, 0.5, 0),
        TextScaled = true
    }
}

local screen = signalAsync("display") {
    Parent = "ScreenPart",
    Face = "Top"
}

signalAsync("writeParent") {
    Parent = screen,
    Item = label
}

Functions

Viscery has many functions from the ones you can only use when you code in Viscery addon to ones usable everywhere.

Functions you can use with signalAsync will be given with their special usages.

visc

visc is the main function for Viscery. It creates an UI item that's usable using other functions.

Arguements:

className

It returns a function which gets the arguement props. When you run this, it creates the item and sets the properties you give. BrickColor colors aren't supported for properties.

Example usage

visc "TextLabel" {
    Text = "Hello, World!",
    Size = UDim2.new(0.35, 0, 0.15, 0),
    Position = UDim2.new(0.5, 0, 0.5, 0),
    TextScaled = true
}

-- This is equivelant to:

visc("TextLabel")({
    Text = "Hello, World!",
    Size = UDim2.new(0.35, 0, 0.15, 0),
    Position = UDim2.new(0.5, 0, 0.5, 0),
    TextScaled = true
})

Using with signalAsync:

It returns the wrapper function for signal, which you give a table that has items that are called className and props. It's basically same as normal except this diffirence.

Example usage

signalAsync("visc") {
    className = "TextLabel",
    props = {
        Text = "Hello, World!",
        Size = UDim2.new(0.35, 0, 0.15, 0),
        Position = UDim2.new(0.5, 0, 0.5, 0),
        TextScaled = true
    }
}

display

Display creates a SurfaceGUI on a specific part you gave with the specific face. It gets a table that has Face and Parent properties.

Example usage

display {
    Parent = "ScreenPart",
    Face = "Top"
}

Using with signalAsync:

It basically returns the display function to you which you can give the same arguements.

Example Usage

signalAsync("display") {
    Parent = "ScreenPart",
    Face = "Top"
}

writeParent

This function sets the parent of a specific item. It gets a table that has Parent and Item.

Example Usage

-- ...

local label = visc "TextLabel" {
    Text = "Hello, World!",
    Size = UDim2.new(0.35, 0, 0.15, 0),
    Position = UDim2.new(0.5, 0, 0.5, 0),
    TextScaled = true
}

local screen = display {
    Parent = "ScreenPart",
    Face = "Top"
}

writeParent {
    Parent = screen,
    Item = label
}

Using with signalAsync:

Like display, this gives you the writeParent function and you can give arguements to it.

Example Usage

local label = signalAsync("visc") {
    className = "TextLabel",
    props = {
        Text = "Hello, World!",
        Size = UDim2.new(0.35, 0, 0.15, 0),
        Position = UDim2.new(0.5, 0, 0.5, 0),
        TextScaled = true
    }
}

local screen = signalAsync("display") {
    Parent = "ScreenPart",
    Face = "Top"
}

signalAsync("writeParent") {
    Parent = screen,
    Item = label
}

clickTrigger

Warning: This function sometimes doesn't works for a reason I'm unsure about. Please report me (comeb3) from Discord when this happens to you.

Warning: This doesn't returns the player who clicked and it's not client-sided.

This function creates a click listener for specific button you give, where the instance you give must have the RBXSignalEvent called MouseButton1Click to work correctly.

This function gets a table that has Button and Event items. Event is a function ( (...) -> any ) and Button is an instance with RBXSignalEvent called MouseButton1Click.

Example Usage

clickTrigger {
    Button = buttonName,
    Event = function()
        print("Clicked!")
    end
}

Using with signalAsync:

Basically, this also returns the base function itself so you can use it like normally.

Example Usage

signalAsync("clickTrigger") {
    Button = buttonName,
    Event = function()
        print("Clicked!")
    end
}

Developer Notice

Viscery is a new addon and SCP: Roleplay keeps getting updates. This addon will get more features soon. If SCP: Roleplay breaks this addon, we will try to fix it.

If you find a bug or have a question, report it to comeb3. Thanks!

On this page