So I have a kill brick that kills the player when they touch it, then quickly respawns them one second later. However, the problem is, after the Player is respawned, the Player Respawns again a couple seconds later. I think this is due to the actual death automatically making the player respawn seconds later, overlapping my script. Any idea how to fix this?
debounce=false
function onTouch(Brick)
if Brick.Parent:FindFirstChild("Humanoid")and debounce==false then
if Brick.Parent.Humanoid.Health>0 then
debounce=true
Brick.Parent.Humanoid.Health=0
local Player=game.Players:FindFirstChild(Brick.Parent.Name)
wait(1)
Player:LoadCharacter()
local Human=game.Workspace:WaitForChild(Player.Name)
Player.Character:MoveTo(game.Workspace.SFLavaT2.Position)
debounce=false
end
end
end
script.Parent.Touched:connect(onTouch)
