I have this script that doesnt work for my text gui. Please help me.
while true do script.Parent.Face.Contents.TextColor3 = Color3.new(0,204,255) wait(.1) script.Parent.Face.Contents.TextColor3 = Color3.new(0,255,0) wait(.1) script.Parent.Face.Contents.TextColor3 = Color3.new(255,255,0) wait(.1) script.Parent.Face.Contents.TextColor3 = Color3.new(255,0,0) wait(.1) script.Parent.Face.Contents.TextColor3 = Color3.new(153,0,153) wait(.1) script.Parent.Face.Contents.TextColor3 = Color3.new(0,0,255) wait(.1) end
Like NoBootAvailable said, you should be using Color3.fromRGB rather than Color3.new. If you're still having a problem, make sure that the gui element you're working with is visible and that your path to the gui element is correct.
To make a few improvements, if you only wanted to use a specific set of colors you can create a table and use a for loop to set the colors.
local colors = {Color3.fromRGB(0, 204, 205), Color3.fromRGB(0, 255, 0)} -- You can continue to add colors here. while true do for index, color in pairs(colors) do script.Parent.Face.Contents.TextColor3 = color wait(0.1) end end
The last approach would blink between colors. Assuming you're trying to create a smoother rainbow effect this may work better. Here I'm using fromHSV rather than Color3. fromHSV parameters include a hue value, making it easier to create a rainbow effect.
while true do for i = 0,1,0.01 do script.Parent.Face.Contents.TextColor3 = Color3.fromHSV(i,1,1) wait(0.1) end end
When handling double or triple digits for Color3
, use Color3:fromRGB()
.
while true do local num = math.random(0, 255) -- This will pick a random number in a range from 0 to 255. script.Parent.Face.Contents.TextColor3 = Color3.fromRGB(num, num, num) wait(.1) end