I am trying to get the players' location using a global script, this is what I have written:
local location = Vector3.new(0,0.5,0)
local playerName = script.Parent.Parent.Parent.Parent.Name
local playerLocation = game.Workspace.playerName.UpperTorso.Position
print(playerLocation)
I don't know why but it keeps saying that playerName is an invalid member of Workspace. Should I put a wait so that ROBLOX has time to load the character? What do I do? Thank you/

1 comment
Thanks for posting this! I was able to get this to work by replacing the '.' with ':' after 'game.' Just adding a little context; the reason you have to use the 'Players' service and wait for an event is because your player is not initially in the game, so you have to wait for the event to fire before getting your position.