Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

GUI colour change?

Asked by
Zyleak 70
8 years ago

I want it to like fade to a certain colour.

This is what i tried:

local frame = script.Parent
r = 255
g = 62
b = 62

repeat
g = g + 1
b = b + 1
frame.BackgroundColor3 = (r, b, g)
wait()
until e == 255
0
*(r/255, b/255, g/255) Zyleak 70 — 8y
0
You can edit your posts. BlueTaslem 18071 — 8y

1 answer

Log in to vote
2
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
8 years ago

You can't group 3 numbers like (r, g, b) -- Lua doesn't know what do with more than one value. You have to explicitly package them up.

This pattern of packaging up a bunch of values is called a constructor. The constructor for Color3 values is Color3.new(r, g, b)

frame.BackgroundColor3 = Color3.new( r / 255, g / 255, b / 255 )
Ad

Answer this question