Make Player Respawn Once They Enter the game

Hello, I am currently making an obby. My obby has a bug that requires players, upon joining, to reset to be able to get back to the stage they last played. ( My obby saves the Player’s stage"

I am not an experienced scripter, but I tried making an Auto-Respawn Script that will Auto Respawn the player Once upon joining. My current script is this and it is not working

local LocalPlayer = game.Players.LocalPlayer
game.Players.PlayerAdded:connect(function(plr)
	LocalPlayer.Character.Humanoid.Health = 0
end)


The Script is local and is parented to workspace
I could not find any solutions. Is anything wrong with my script?

make a localscript and put it into StarterPlayerScripts

local LocalPlayer = game.Players.LocalPlayer
local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
character:WaitForChild("Humanoid").Health = 0
script:Destroy()
2 Likes

Thank you so much. It works now!