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