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

I can't change CFrame of the humanoid root part?

Asked by 6 years ago
Edited 6 years ago

I am trying to teleport the character of a player to a part every time their character is added.

The script here is a LocalScript inside the StarterPack.

local player = game.Players.LocalPlayer
local character = player.Character

player.CharacterAdded:connect(function()
    character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.SpawnPoint.Position)
end)

But nothing happens, not even an error message comes up.

Thank's in advance.

2 answers

Log in to vote
0
Answered by 6 years ago

you don't need a localscript to do this, it wouldn't work with FE anyways,

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        Character:MoveTo(workspace.SpawnPoint.Position)
    end)
end)
0
It doesn't work. Neodosa 7 — 6y
Ad
Log in to vote
0
Answered by 5 years ago

Try adding a wait() right before you change the CFrame of the HumanoidRootPart, characters take a tiny bit of time to load fully. If that doesn't work, make it a wait(0.1) for good measure.

Answer this question