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

How do i make it so i respawn where i died?

game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Character.Humanoid.Died:Connect(function()


local PositionWhenDied = Character.HumanoidRootPart.Position
Player.CharacterAdded:Wait()
Player.Character:MoveTo(PositionWhenDied) 
end)
end)
end)

so this is the script and i legit dont know what to do anymore so any help is apreciated

1 comment

0

try using SetPrimaryPartCFrame instead of MoveTo

1 answer

function D(p, o)
	while game.Workspace:findFirstChild(p).Humanoid.Health <= 0 do
		wait(0.5)
	end
	local n = game.Workspace:findFirstChild(p)
	if n ~= nil then
		n.UpperTorso.CFrame = CFrame.new(o)
	end
end

while true do
	wait(1)
	w = game.Workspace:children()
	for i = 1, #w do
		if game.Players:findFirstChild(w[i].Name) ~= nil then
			if w[i].Humanoid.Health <= 0 then
				p = w[i].Name
				o = w[i].UpperTorso.Position
				D(p, o)
			end
		end
	end
end

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