Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Problem with Color3.new any workarounds/fixes?

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)

2 answers

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.

2 comments

0

I mean it wont display an rgb color

0

Write every movement on paper that should help.

This discussion is preserved as it was. New answers, comments, and votes are closed.