Script:
local debounce = false
function noclout() debounce = true if game.Workspace.DoorPartOne.Anchored == true then script.Parent:Play() wait (7) debounce = false end end
game.Workspace.JitterOne:Connect(noclout)
No clue why this doesnt work How do i fix this?
One error with this is your use of a debounce
. A debounce needs to be checked it's value at the start of each group of code you want to run inside of a function.
Another error is that you have game.Workspace.JitterOne:Connect(noclout)
which needs some sort of action such as Touched in order to do something.
local debounce = false function noclout() if debounce == false then --You need to check debounce's value before your code to use it debounce = true if workspace.DoorPartOne.Anchored == true then script.Parent:Play() wait(7) end debounce = false --I would change debounce out side of the if statement incase it isn't anchored and you anchor it in game or something end end workspace.JitterOne.Touched:Connect(noclout) --I'm assuming if you want when it is touched? --You need some sort of action in order to connect to a function using Connect
If I have helped answer your question please remember to accept my answer. If I have messed up please feel free to message me or comment on my answer for what I could have done better. Thanks!