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
	LocalPlayer.Character.Humanoid.Health = 0

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

Thank you so much. It works now!