Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to add a specific death?

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

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)

1 comment

0

Oh, thanks so much, this really helped

This discussion is preserved as it was. New answers, comments, and votes are closed.