I feel your pain. Roblox is very confusing, despite their claims that it is an easy way to learn scripting.
To get a player's position (server side) you need to access the player's character property. (
Before you can access the Character property, you need to get the player's object. This can be done be capturing the player object when they first load onto the server using a regular script somewhere in the Workspace.
The game I'm working on is a single player game, so I store the player object in an object container which I access whenever I need the value in any of my server side scripts.
workspace.Data.Player.Value = player
This script fires when a player joins the game. In my case, only one player is on the server, but you can adapt the code to track other players as you see fit.
Data' is just a folder I put in the Workspace and '
Player' (Capital P) is an
ObjectValue container I named '
Player' which I use to store the player object. You can rename or adjust that any way you see fit, or store the player object in any manner you wish. Now if you want to access the player's properties, including position, you would do this in a regular script:
local player = Workspace.Data.Player.Value --Get's player object and stores it in 'player' variable
local var = player.Character.UpperTorso.Position -- Gets vector3 position
Or, If you want to get the individual X, Y, Z co-ordinates
local varX = player.Character.UpperTorso.Position.X
local varY = player.Character.UpperTorso.Position.Y
local varZ = player.Character.UpperTorso.Position.Z
There are different ways of getting the player object, but this is the way that I am using for my purposes.
UpperTorso is used for
R15 Humanoids, so it may not work on
Humanoid models that are not
UpperTorso is just one of the
humanoid body parts, which is used to track player position.
If you want to track a different body part, run your game in the Developer Studio, and while it is running, click on
StarterPlayer and then
HumanoidDefaultBodyParts (found in Explorer view) which will give you a list of trackable body parts you can use instead of
UpperTorso. The only way to track a player position is through a body part.
Hope this helps, and good luck.
The above link will take you to a developer page. If you look at the far right, you will see a list of properties and events that are used in conjunction with the player object.