Help with obby checkpoints system

player.respawnlocation = 3 but player spawn on void

this script is a local script and its on startercharacterscripts

and i want if player die spawn in last stage he reach

and i maked a folder in workspaces and i put the checkpoints there and i name it 1 2 3 4 etc also i make script on it to change player.leaderstats.stage to checkpoint name and its work

and i use this script for deathboard to do tasks on the obby and this is the script and some pictures

Screenshot 2021-07-11 030245

   local player = game.Players.LocalPlayer
local PetGui = game.ReplicatedStorage.PetGui
local stats = player:WaitForChild("leaderstats")
player.character.Humanoid.Died:connect(function()
	player.leaderstats.Deaths.Value = player.leaderstats.Deaths.Value +1
	player.RespawnLocation = workspace.Checkpoints[tostring(stats.Stage.Value)]
	if player.leaderstatsP.FirePet.Value == 1 then
		player.leaderstatsP.FirePet.Value = 2	
		player.PlayerGui.PetGui:Destroy()
		game.StarterGui.PetGui:Destroy()
		local clone = PetGui:Clone()
		clone.Parent = game.StarterGui
		local clone2 = PetGui:Clone()
		clone2.Parent = player.PlayerGui
		if player.PlayerGui.ShopGui.Enabled == true then
		player.PlayerGui.PetGui.Enabled = true
		game.StarterGui.PetGui.Enabled = true
	end
end
end)

but the problem is the player spawn in void

1 Like

I’ve had this problem too.
I don’t know the best way to get around this.
But what I did was:

After a player Touches next checkpoint I Delete the Old one (Client Side)
And Clone a new one from ReplicatedStorage, and put it in the vector 3 i want. (Client Side again obviously)

(the checkpoints are invisible, and the checkpoints you can see are just Part placeholders)

hope this helps!

i cant do that because i have 150 stage and its hard to change anything in it

ok…
can you use coding to do it for you?

When i have a big game, and I want to change stuff. But it would take forever (like this)
I would use coding to do it for me!

you can use a for loop to make a table of all the checkpoint vector3s, then use that table on the script I just suggested!

If you can’t do this either for whatever reason, I’m sorry but I don’t know any other way of doing this efficiently!

ty for your help

aaaaaaaaaaaaa