How do you make a Imagelabel change colors?

Hello! Im trying to make It so my Image label will change colors, when I use this script

while true do
	script.Parent.BackgroundColor3 = Color3.new(1,0,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0.1,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0.2,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0.3,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0.4,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0.5,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0.6,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0.7,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0.8,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0.9,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,1,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.9,1,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.8,1,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.7,1,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.6,1,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.5,1,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.4,1,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.3,1,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.2,1,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.1,1,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,1,0)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,1,0.1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,1,0.2)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,1,0.3)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,1,0.4)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,1,0.5)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,1,0.6)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,1,0.7)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,1,0.8)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,1,0.9)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,1,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,0.9,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,0.8,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,0.7,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,0.6,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,0.5,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,0.4,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,0.3,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,0.2,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,0.1,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0,0,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.1,0,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.2,0,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.3,0,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.4,0,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.5,0,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.6,0,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.7,0,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.8,0,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(0.9,0,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0,1)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0,0.9)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0,0.8)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0,0.7)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0,0.6)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0,0.5)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0,0.4)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0,0.3)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0,0.2)
	wait(0.01)
	script.Parent.BackgroundColor3 = Color3.new(1,0,0.1)
	wait(0.01)

It doesnt change colors, I need help despritly

1 Like

If it’s a Gui element do script.Parent.BackgroundColor3 = Color3.frmRGB(255, 255, 255).

Why not use a Frame? If you want to use an ImageLabel then use ImageColor3 and notBackgroundColor3.

Yo what the-

  18:55:09.633  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:55:19.787  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:55:27.685  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:55:35.358  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121

6:56 Edit: YO WHAT TEH EHCLSKDIBHENIK@IJRKJ

  18:55:06.565  Vector Racing auto-recovery file was created  -  Studio - C:/Users/mrtix/OneDrive/Documents/ROBLOX/AutoSaves
  18:55:09.633  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:55:19.787  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:55:27.685  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:55:35.358  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:55:42.991  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:55:50.713  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:55:58.335  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:56:05.963  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:56:13.591  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:56:21.214  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  18:56:28.835  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121

Like this:

local imageLabel = script.Parent

while wait(0.01) do
    imageLabel.BackgroundColor3 = Color3.fromRGB(math.random(0,255), math.random(0,255), math.random(0,255))
end

Nothing Happened O O I even tried switching It to UPPERCASE i and it did nothing

wait, so does this mean I have to change A L L of those

NVM I can just use the replace feature and see if it works

ITS HAPPENING AGAIN

  19:01:28.931  Vector Racing auto-recovery file was created  -  Studio - C:/Users/mrtix/OneDrive/Documents/ROBLOX/AutoSaves
  19:01:32.123  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121
  19:01:41.971  Players.NubblyFry.PlayerGui.ScreenGui.ImageLabel.Script:121: Expected 'end' (to close 'do' at line 1), got <eof>  -  Studio - Script:121

WHY DO I HAVE TO KEEP GETTING TOURCHERD BY EOF

You forgot end to like end the while loop.

cant I just loop it so it can go inf?

What are you trying to do? Cycle through the colors of the rainbow?
If so, I highly suggest simply cycling through hue. It is much better than setting the color like you are trying to do.

This code is designed to work in a frame with a local script inside of it. You can modify it to fit your needs.

local speed = 0.1

game:GetService("RunService").RenderStepped:Connect(function(dt)
	local h, s, v = script.Parent.BackgroundColor3:ToHSV()
	script.Parent.BackgroundColor3 = Color3.fromHSV(h + speed * dt, 1, v)
end)

Since this is a visual effect on the client only, RenderStepped is better than using a while wait() do loop.

2 Likes

It hasn’t done anything :^( Did I place things wrong or…

Yes I am trying to do that, it was hard to explain

Yes, you likely put something somewhere wrong. Any errors?

1 Like

No I dont see any errors popping up in the Output

You’ve used while true do and it require end

Hello,
If you’re looking for a random color changing script, type this command:

while true do

        script.Parent.ImageColor3 = Color3.new(math.random(), math.random(), math.random(), math.random, math.random())

        wait(0.5)

        end

I hope I can help. I wish you a good day!
If it didn’t work for you or you have other problems, I’ll try to help :slight_smile:

2 Likes

I want it to be infinite not end :^(

while true do is alwais infinite (looped) “end” is needed to complete the function.

Its working very nice!

Question, Is their a way I can make it smoother?

robloxapp-20210326-0930555.wmv