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

Debounce not working?!

Asked by
Bulvyte 388 Moderation Voter
7 years ago
Edited 7 years ago
debounce = false
Gate = script.Parent 
modelname="Desert Team"
function onTouched(hit) 
local human = hit.Parent:FindFirstChild("Humanoid") 
if (human ~= nil ) then
if game.Players:playerFromCharacter(hit.Parent).TeamColor==game.Teams:findFirstChild(modelname).TeamColor then
if debounce == false then
debounce = true
script.Open:Play()
Gate.CanCollide = false 
Gate.Transparency = 0.5
wait(1) 
Gate.CanCollide = true 
Gate.Transparency = 0
script.Close:Play()
else
if debounce == false then
debounce = true
human.Health = 0
script.Beep:Play()
Gate.BrickColor = BrickColor.new("Bright red")
wait(1)
Gate.BrickColor = BrickColor.new("Really black")
end
end 
end
end
end
debounce = false

Gate.Touched:connect(onTouched)

If the guy who touches door isnt from team play a b33p. so debounce doesn't work also the same if in team

Answer this question