I am trying to script a script that when you clicked on it, the door un-Cancollided and make a person come in. <-- That part works.
When the button is pressed, the color of the button changed to red then it changes to green. This part doesn't work..Don't know why?
I tested this script multiple times and still doesn't work.
function onClicked()
script.Parent.Parent.Door.Transparency= 0.5
script.Parent.Parent.Door.CanCollide= true
wait(0.1)
script.Parent.Parent.Button.Color = 255, 0, 0 --Button turns to the color red
wait(0.9)
script.Parent.Parent.Door.Transparency= 0.4
script.Parent.Parent.Door.CanCollide= true
wait(0.9)
script.Parent.Parent.Door.Transparency= 0.2
script.Parent.Parent.Door.CanCollide= false --Make a person(s) can go through the door
wait(3)
script.Parent.Parent.Door.Transparency= 0
script.Parent.Parent.Door.CanCollide= true --Can't make person(s) go in the door anymore.
wait(0.1)
script.Parent.Parent.Button.Color= 0, 255, 0 --Button turns to the color green
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Thx!
