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

Player does not respawn underwater?

Asked by 4 years ago

I'm trying to make a death where the floor underneath the player drops and the player drops into water beneath and the floor comes back above them making them trapped, and this scripts slowing kills them as if they were drowning but when they die they don't respawn, they are just lifeless and cannot move/swim. (This script is in StarterGui to make it client-based)

game.Workspace.FloorDrop.partyah.MeshPart.ClickDetector.MouseClick:Connect(function(playa)
    if not debounce then
        debounce = true
        -- below is the floor opening and closing script
    for i = 0, 13, 1 do
        game.Workspace.FloorDrop.floor:SetPrimaryPartCFrame(game.Workspace.FloorDrop.floor:GetPrimaryPartCFrame() * CFrame.new(0, 0, i))
        wait(0.05)
        end
            for i = 0, 4, 0.2 do
        playa.Character:SetPrimaryPartCFrame(playa.Character:GetPrimaryPartCFrame() * CFrame.new(0, -i, 0))
        wait(0.01)
    end
    for i = 0, 13, 1 do
        game.Workspace.FloorDrop.floor:SetPrimaryPartCFrame(game.Workspace.FloorDrop.floor:GetPrimaryPartCFrame() * CFrame.new(0, 0, -i))
        wait(0.05)
        end
    end
    wait(2)
--this kills the player
    for i = 1, 10, 1 do
        local peep = playa.Character:WaitForChild("Humanoid")
        peep.Health = peep.Health - 10
        wait(0.5)
    end
end)

Any help with this?

Answer this question