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

My script has no errors, but it doesn't work?

Here is my updated script (thanks everyone!):

if game.Workspace.Light1.BrickColor == ("Bright yellow")and
   game.Workspace.Light2.BrickColor == ("Bright yellow")and
   game.Workspace.Light3.BrickColor == ("Bright yellow") then
game.Workspace.Door1.Position = Vector3.new(-49, 6.99, 8.5)
game.Workspace.Door2.Position = Vector3.new(-60, 6.99, 8.5)
end 

The door's position doesn't change when all three bricks are Bright yellow?

Help?

Thank you

1 answer

I use to do the same thing. BrickColors are not string values. They are BrickColor values. Therefore, you need to check like this:

if game.Workspace.Light1.BrickColor == BrickColor.new("Bright yellow") then

Also keep in mind, however, that if statements only run once. Unless you have other code surrounding that, it will only check if all three bricks are bright yellow a single time, and will not care if they are all bright yellow later. If statements only run once.

4 comments

0

Thank you, but in order to make the doors change positions, will my script work?

0

They should change positions, if you follow my advice in the answer. Otherwise, they won't.

0

Okay, I changed the BrickColor part, and I only need the script to check once, to open the doors once, but nothing happened?

0

If you just put an if statement inside a script, it will check as soon as the game starts. The bricks might not even be loaded at that time.

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