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 spawn where i died after i load my character?

rs = game:GetService("ReplicatedStorage")
ss = game:GetService("ServerStorage")

rs.q.OnServerEvent:Connect(function(player)
	local NewChar = ss.Rogue:Clone()
	local Pos = player.Character:GetPrimaryPartCFrame()
	player.Character :Destroy()
	player.Character = NewChar
	NewChar.Parent = workspace
	NewChar:SetPrimaryPartCFrame(Pos)
	wait(5)
	player:LoadCharacter() 
	
	game.Players.PlayerAdded:Connect(function(Player)

Player.CharacterAdded:Connect(function(Character)


Character.Humanoid.Died:Connect(function()


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

end)
end)
end)
	
end)

so this is the script but it doesnt seem to work

1 answer

Well from what I can see, you are definitely trying to save the position of the player when it died. Now I'm not very good at scripting, so my best suggestion is to

1: Proper capitalization and tree detection. E.g. NewChar = game.Workspace not NewChar = workspace.

2: Try remaking it and see if anything will make a little more sense as you do it.

3: player.Character:Destroy()

if these tips didn't work, then I don't know what will. Well, maybe try putting a spawn location or part where the player died to reference where it died and not just seeing where the torso is. I hope that helps.

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