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

i have a door that needs to be invisible and walk through when the flag is blue need help?

Asked by 5 years ago

if game.Workspace.cap.flag == BrickColor.new("Bright blue")then game.Workspace.door.Transparency = 1 game.Workspace.door.CanCollide = true else game.Workspace.door.Transparency = 0 game.Workspace.door.CanCollide = false end

-- i have no idea why it's not working i need help trying to get the door to be invisible and CanCollide = true when the flag is Bright blue

1 answer

Log in to vote
0
Answered by 5 years ago
if game.Workspace.cap.flag == BrickColor.new("Bright blue") then game.Workspace.door.Transparency = 1
game.Workspace.door.CanCollide = true
else
game.Workspace.door.Transparency = 0
game.Workspace.door.CanCollide = false
end

Just to make your script more organized. First off, game.Workspace.cap.flag isn't a valid property for BrickColor. I don't know your doors children, so if the flag is named flag under cap then you write the BrickColor property, like this.

game.Workspace.cap.flag.BrickColor

Without the BrickColor property, you're asking the script if the flag is equal to a BrickColor of bright blue, or has a value of that, which doesn't make sense. Here might be a working script.

if game.Workspace.cap.flag.BrickColor == BrickColor.new("Bright blue") then
game.Workspace.door.Transparency = 1
game.Workspace.door.CanCollide = true
else
if game.Workspace.cap.flag.BrickColor ~= BrickColor.new("Bright blue") then
game.Workspace.door.Transparency = 0
game.Workspace.door.CanCollide = false
end

This script might not work because of the ends. I just made this up. Also, maybe if this script works, putting this script in a while loop, a loop that goes forever, may be good because it's always checking for the contents of the flag color and stuff.

Ad

Answer this question