What is wrong with my script?

I have no idea what is wrong. The ‘=’ in the while loop is underlined.

What is wrong with my script

Anyone know the problem?

When checking if something is true or false, you’ll need to use

==

as opposed to

=

some more information here.

2 Likes

Ooooooohhhhhhh, thanks. I’ll see if this works.

Also, you are trying to check if the brick color = BrickColor.Random()

Won’t work since the brick color is just going to be different.

1 Like

I suggest you do,

while wait(0.001) do
game.Workspace.EpilepsyPart.BrickColor = BrickColor.Random()
end

Still including the wait(0.001) inside the loop or no?

Just to clarify things. If you want to check if something is equal to something, you’d use == Example:

local var = 1

if var == 1 then return end

but if you’d want to set a value to something, you’d use = Example:

local var = 1

if var == 1 then var = 2 end

Yes, otherwise the script is going to crash.

No that’s not needed, unless you’re trying to have only certain points at which you want it to be rainbow. Something like that would look like this.

local RainbowTime = false

RainbowTime = true

while RainbowTime == true do wait(0.001)
    game.Workspace.EpilepsyPart.BrickColor = BrickColor.Random()
end

Okay. [Text to make it sendable.]

1 Like

No need since it’s already a wait loop.

1 Like

Also just a little sidenote, I wouldn’t recommend calling something epilepsy part, as you wouldn’t want moderators to be upset over that. :slightly_smiling_face:

It works very perfectly with the very quickly colour change.

1 Like

I fixed some mistakes

local RainbowTime = false

RainbowTime = true

while RainbowTime do; wait(0.001)
    game.Workspace.EpilepsyPart.BrickColor = BrickColor.Random()
end
1 Like

Well it kinda is like an epilepsy room you have to escape soo…

I just wanted to make sure he had a good grasp on the relational operators but that works better :+1:

1 Like

I’d recommend just calling it rainbowpart but you can choose to do what you like.

Also be sure to mark a solution if your problem is solved, else ask anything else you need help with :grinning:

:FLOOSH:
You should give the player’s a warning of that by the way. So no one gets a seizure from it.

Yes, I will in the description.