Color Wheel Script not working

Whatever color is selected on the wheel, it would be its part color. The issue is, the it won’t set the part color. I tried getting textlabel info but it counted only for 1 argument, and fromRGB needs 3.
Whats wrong?
script:

local button = script.Parent.Parent.TextButton

button.MouseButton1Down:Connect(function()
    local part = workspace:WaitForChild("part")
    local part2 = workspace:WaitForChild("Part")

    part.Color = Color3.fromRGB(script.Parent.Colour.TextLabel.Text)
    part2.Color = Color3.fromRGB(script.Parent.Colour.TextLabel.Text)
    script.Parent.Visible = false
    button.Visible = false
end)
1 Like

fromRGB needs three arguments, yes.

If you expect the user to split the numbers via a comma, use string.split and unpack:

part.Color = Color3.fromRGB(table.unpack(thing.Text:split(", ")))

What do you refer “thing” as?? What is the claim?

That was more of a pseudocode. Coding on phone sucks.

thing refers to to your script.Parent.Colour.TextLabel, so the code would look like this:

local button = script.Parent.Parent.TextButton
local selectedColour = script.Parent.Colour.TextLabel

button.MouseButton1Down:Connect(function()
    local part = workspace:WaitForChild("part")
    local part2 = workspace:WaitForChild("Part")

    part.Color = Color3.fromRGB(table.unpack(selectedColour.Text:split(", ")))
    part2.Color = Color3.fromRGB(table.unpack(selectedColour.Text:split(", ")))
    script.Parent.Visible = false
    button.Visible = false
end)
1 Like