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

How to add a specific death?

Asked by 6 years ago

In my game, I want it to be so that once a player dies, he waits 1 second and comes back alive on the same spot he died. Please help me.

1 answer

Log in to vote
0
Answered by
zyrun 168
6 years ago

First you need to get ahold of the player. Often times we do it on entry.

game.Players.PlayerAdded:Connect(function(Plr) --Plr is our Player that joined
-- Checks for the specific player (In this case, by name)   
    if Plr.Name == "turbomegapower12345" then 
--This is for when the specific player above dies
        Plr.Character.Humanoid.Died:Connect(function() 
            local PositionTable = {} -- Creates a table to hold the players positon
--Adds the cahracters positon to the table          
            table.insert(PositionTable, Plr.Character.HumanoidRootPart.Position)
            wait(1) 
            Plr:LoadCharacter() -- Revives the player
--Positions the player at the spot that he died
            Plr.Character.HumanoidRootPart.CFrame = CFrame.new(PositionTable[1])

        end)    
    end
end)
0
Oh, thanks so much, this really helped turbomegapower12345 48 — 6y
Ad

Answer this question