I am new to scripting, I started learning this week.
I have a block that has a click detector, which has the following script in it. I want to click a block, and then have three doors turn on their collision and also turn off their transparency (meaning it is visible to the player now). I don't even know if the script knows which blocks to change -
script.Parent.MouseClick:Connect(function ()
game.Workspace("Red Door"):Connect(function ()
script.Parent.CanCollide = true
wait(0)
script.Parent.Transparency = 0
wait(0)
game.Workspace("Green Door"):Connect(function ()
script.Parent.CanCollide = true
wait(0)
script.Parent.Transparency = 0
wait(0)
game.Workspace("Blue Door"):Connect(function()
script.Parent.CanCollide = true
wait(0)
script.Parent.Transparency = 0
wait(0)
end)
end)
end)
end)

7 comments
Doesn't work - I looked at the developer console and it said that the Red Door is not a valid member of Workspace and there is an error with Line 2
then you do not have the doors in the workspace, in order to fix this you must move your red, green, and blue doors into the workspace or change the pathing in the code to go to wherever they are. Ex. if they were inside of a model called "House" which was located in the workspace you would do game.Workspace.House["Red Door"].CanCollide = true
If you did the last part instead of moving the doors into the workspace then you would have to correct the directory on lines 2-7
I double checked and all three of the blocks are in the workspace. Is there any other possible error I could have encountered?
make sure the doors are anchored
WAIT A MINUTE ANCHORING IT ACTUALLY WORKED LMAO
can you accept this as an answer pls