I have put together a script from multiple sources and examples from around the net (that's the extent of my scripting ability so far) which, while likely a bit messy, should work in theory. I've used print() at all the key points to ensure that things are resolving as needed but the CFrame.new() just doesn't seem to want to fire. The script should run as a player connects, relocating them to the position of a previous checkpoint (models are named numerically and the primary part is also named the same hence the [progress][progress] path. The co-ordinates supplied come back accurate) Please, could some kind soul tell me why?
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) local progress = player.leaderstats.Stage.Value local Root = char:FindFirstChild("HumanoidRootPart") Root.CFrame = CFrame.new(game.Workspace.checkPoints[progress][progress].Position + Vector3.new(0,3,0)) end) end)
I've tried a variety of other options including MoveTo which just made the player drift towards a nearby wall lol. Thanks in advance.
The problem is the game is trying to move the player before it finished loading. Try
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) local progress = player.leaderstats.Stage.Value local Root = char:FindFirstChild("HumanoidRootPart") repeat wait() until player.Character:FindFirstChild("Head") -- waits until players head is loaded before moving Root.CFrame = CFrame.new(game.Workspace.checkPoints[progress][progress].Position + Vector3.new(0,3,0)) end) end)