Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why can't I get the position of the Player?

This is what I got

player = game.Players.LocalPlayer.Character.HumanoidRootPart.Position.X
print(player)

When I run this I get an error saying something about the Character. Why does this happen?

1 answer

You should check if the player's character exists first, if you are running the script immediately when the game starts then there is a good chance it will be executed before the player spawns

local Character = game:GetService("Players").LocalPlayer.Character or game:GetService("Players").LocalPlayer.CharacterAdded:Wait()
local Position = Character.HumanoidRootPart.Position.X
print(Position)

This discussion is preserved as it was. New answers, comments, and votes are closed.