Colorpickers

To create a colorpicker, use this.

local Colorpicker = Tabs.Main:AddColorpicker("Colorpicker", {
    Title = "Colorpicker",
    Description = "Description for colorpicker",
    Default = Color3.fromRGB(96, 205, 255),
    -- (Optional) Transparency = 0,
    Callback = function(color)
        print("Colorpicker was changed:", color)
    end
})

Change local Colorpicker to a different variable name every time. It can be anything.

You can remove the local Colorpicker if you aren't gonna use it.

Colorpicker (name of colorpicker) is saved in the Options variable.

You can try to remove the name, but I've never tried to.

To allow users to set the transparency, just make the Transparency = 0.

You can get the value anywhere simply by using this: (Put your variable name)

Colorpicker.Value

Or, whatever you put as the name of the toggle.

Options.Colorpicker.Value

Functions

You can check when the colorpicker is changed, but Callback does the same thing.

Colorpicker:OnChanged(function()
    print("Colorpicker changed:", Colorpicker.Value)
end)

To check the transperency, (if you're using it)

Colorpicker:OnChanged(function()
    print(
        "TColorpicker changed:", TColorpicker.Value,
        "Transparency:", TColorpicker.Transparency
    )
end)

To set the value of a colorpicker, use this.

Colorpicker:SetValueRGB(Color3.fromRGB(0, 255, 140))

Or, if you're using transperency.

Colorpicker:SetValue({0, 100, 100}, 0.5) -- hsv, transparency

Last updated