I'm trying to use RGB Color with Color3.new but it won't change the color to the rgb number I put in. I tried other methods but didn't work
local debounce = false local button = script.Parent script.Parent.MouseButton1Click:connect(function() if debounce == false then button.BackgroundColor3 = Color3.new(101, 181, 50) button.Text = "No" debounce = true elseif debounce == true then button.BackgroundColor3 = Color3.new(170, 68, 68) button.Text = "Yes" debounce = false end end)
Your problem is that Color3.new()
only takes a number between 0 and 1. If you want it between 0 and 255, like most people do, you have to divide it by 255 to again get a number between 0 and 1.
local debounce = false local button = script.Parent script.Parent.MouseButton1Click:connect(function() if debounce == false then button.BackgroundColor3 = Color3.new(101/255, 181/255, 50/255) button.Text = "No" debounce = true elseif debounce == true then button.BackgroundColor3 = Color3.new(170/255, 68/255, 68/255) button.Text = "Yes" debounce = false end end)
I think it needs to wait because it does loop without waiting and crashes. I don't know I just think.