Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does the player not spawn in the spot I want even when I change their CFrame?

Asked by
Kami_Yo 72
5 years ago
Edited 5 years ago

I'm a little confused at the moment. I'm trying to create a checkpoint system and it isn't working. I'm trying to update where the player spawns when they reset/die but for some reason they still spawn at the same default spot over and over.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAppearanceLoaded:Connect(function(char)
        print("CHARACTER APPEARANCE LOADED RAN")
        print("HumanoidRootPart: ", char:WaitForChild("HumanoidRootPart").CFrame)

        char:WaitForChild("HumanoidRootPart").CFrame = game.Workspace.TPPart.CFrame

        print("HumanoidRootPart: ", char:WaitForChild("HumanoidRootPart").CFrame)
        print("TPP CFRAME: ", game.Workspace.TPPart.CFrame) 

And when I reset the game, the CFrame is changed, I can see it in the print statement. But the player still stays in the spot. Why is that? I don't get it.

1 answer

Log in to vote
0
Answered by
Kami_Yo 72
5 years ago

Ok. I changed line 6 to:

game.Workspace[player.Name].HumanoidRootPart.CFrame = game.Workspace.TPPart.CFrame

And it worked.

Ad

Answer this question