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

How do I fix this error?

I've spend ages trying to figure out another error and now I have one that I can't solve.

gui=script.Parent
player=Game.Players.LocalPlayer

function Clicked()
	gui.TextButton.BackgroundColor3=255, 78, 134
	wait(2)
	gui.TextButton.BackgroundColor3=155, 255, 247
end

script.Parent.TextButton.MouseButton1Click:connect(Clicked)

The output shows with this:

13:57:55.385 - Players.Player1.PlayerGui.P.LocalScript:5: bad argument #3 to 'BackgroundColor3' (Color3 expected, got number) 13:57:55.388 - Script 'Players.Player1.PlayerGui.P.LocalScript', Line 5 13:57:55.391 - Stack End 13:57:55.393 - Disconnected event because of exception

2 answers

✓ Accepted answer

You should do the follow:

-- Change:
gui.TextButton.BackgroundColor3 = 255, 78, 134
wait(2)
gui.TextButton.BackgroundColor3 = 155, 255, 247
-- To:
gui.TextButton.BackgroundColor3 = Color3.new(255, 78, 134)
wait(2)
gui.TextButton.BackgroundColor3 = Color3.new(155, 255, 247)

The BackgroundColor3 property requires a Color3 Value.

You're trying to set the property with numbers, when you need to set it as a Color3 with Color3.new(). Like this:

gui.TextButton.BackgroundColor3=Color3.new(255, 78, 134)

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