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
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
