I'm trying to get the player's character.
1 | local player = game.Players:WaitForChild( "LocalPlayer" ) -- Wait for player join |
2 | local char = player:WaitForChild( "Character" ) -- Wait for character add |
3 |
4 | char.HumanoidRootPart.CFrame = CFrame.new( 100 , 500 , 136 ) |
Can't get the LocalPlayer like that. The character either. Two ways to get the character , first get the player
1 | local players = game:GetService( "Players" ) |
2 | local plr = players.LocalPlayer or players.PlayerAdded:Wait() |
3 | local char = plr.Character or plr.CharacterAdded:Wait() |
4 |
5 | char.HumanoidRootPart.CFrame = CFrame.new( 100 , 500 , 136 ) |