Setting the Player's position

It finds it since it prints the instance itself, which is called 0, so that leads me to believe that checkpoint 0 is already right under you probably. Select it in explorer and check if it’s already under you or somewhere else, also make sure you use the edited version of the code I replied with before, since adding the offset ensures it doesn’t cause issues.

Where is the checkpoint named “0” exactly?

-87.926, -23.416, 193.491, where I want the player to spawn.

Just now I just spawn at the default spawn point and die in the void.

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local HRP = Character:WaitForChild("HumanoidRootPart")
		HRP:GetPropertyChangedSignal("CFrame"):Wait()
		HRP.CFrame = workspace.Checkpoints["1"].CFrame
	end)
end)

This works, but only in a separate script, which is why I have used "1" instead of ServerData[Player.leaderstats.Level]. I did try it in the main one, it just doesn’t seem to want to work.

1 Like

This works for what I’m using it for now. Thank you to everyone, this has been really helpful.

I just tried it some minutes ago and worked. If you don’t want to write the values one by one, you can use this one.

Put this script in LocalScript in StarterPlayerScripts.

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()

    local player = game.Players.LocalPlayer

    local character = player.CharacterAdded:Wait()

    local hrp = character:WaitForChild("HumanoidRootPart")
    local leaderstats = player:WaitForChild("leaderstats")
    local level = leaderstats:WaitForChild("Level")

    for i , descendants in pairs(game.Workspace.Checkpoints:GetDescendants()) do
	    if level.Value == tonumber(descendants.Name) then
		    hrp.CFrame = descendants.CFrame + Vector3.new(0, 6, 0)
	    end
    end
end)

And put this script in ServerScriptService.

game.Players.PlayerAdded:Connect(function(player)
   game.ReplicatedStorage.RemoteEvent:FireClient(player)
end)
1 Like