So I was messing around with functions and names, so I made a script so that a door that named "DANK"(because I wanted the script or whatever to locate that only) would become locked, after the player touches it, slowly fade away using transparency, then make it so the player can walk through it, and last, make it so the player can't walk through it. My problem is, every time I touch the door again, the transparency goes crazy. How do I fix this? Here's the script.
function onTouch()
wait(.3)
workspace.DANK.Locked = true
wait(1)
workspace.DANK.Transparency= .3
wait(1)
workspace.DANK.Transparency= .5
wait(1)
workspace.DANK.Transparency =.6
wait(1)
workspace.DANK.Transparency=.8
wait(1)
workspace.DANK.Transparency=1
wait(1)
workspace.DANK.Transparency=0
wait(1)
workspace.DANK.CanCollide= false
wait(3)
workspace.DANK.CanCollide=true
print'the script works m8'
end
game.Workspace.DANK.Touched:connect(onTouch)
