Checkpoint Simple Wont work?



game.Players.PlayerAdded:Connect(function(plr)
        plr.CharacterAdded:Connect(function()
            local char = plr.Character or plr.CharacterAdded:Wait()
            local humanoidRootPart = char:WaitForChild("HumanoidRootPart")
            local profile = DataService:GetNumber(plr)
            local checkpoint = profile.Checkpoint
            humanoidRootPart.CFrame = game.Workspace.Checkpoint[checkpoint].TP.CFrame 
        end)
    end)

This just won’t work. Everything is anchored nothing is falling. No errors. It prints the profile checkpoint too…

1 Like

Not sure off the top of my head why it wouldn’t work, but try redefining the char variable?
Maybe try:

local char = workspace[plr.Name]

I usually do this convention if it doesn’t work otherwise.

There’s an example for teleporting a Character as soon as they spawn on developer.roblox.com in the CharacterAdded page. You need to wait a physics step, RunService.Stepped:Wait(), before CFraming.

I’m assuming it’s because roblox handles loading the character in workspace and teleporting them to where they should spawn by default in that first physics step.


game.Players.PlayerAdded:Connect(function(plr)
        plr.CharacterAdded:Connect(function(char)
           local HumanoidRootPart = char:WaitForChild("HumanoidRootPart")
           repeat
               wait()
           until HumanoidRootPart
            local checkpoint = tostring(plr:WaitForChild("leaderstats").Stages.Value)
            local checkpointFolder = game.Workspace:WaitForChild("Checkpoint")

code fixed :smiley:

1 Like