lmkarocks.blogg.se

Roblox get character from player
Roblox get character from player




roblox get character from player

Players.CharacterAutoLoads is true, but can be manually loaded 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.The Character property contains a reference to a Model containingĪ Humanoid, body parts, scripts and other objects required for The above link will take you to a developer page. The only way to track a player position is through a body part.

roblox get character from player

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. UpperTorso is just one of the humanoid body parts, which is used to track player position. There are different ways of getting the player object, but this is the way that I am using for my purposes.Īlso, UpperTorso is used for R15 Humanoids, so it may not work on Humanoid models that are not R15. Or, If you want to get the individual X, Y, Z co-ordinates local varX = .X Now if you want to access the player's properties, including position, you would do this in a regular script: local player = -Get's player object and stores it in 'player' variable You can rename or adjust that any way you see fit, or store the player object in any manner you wish. ' 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. In my case, only one player is on the server, but you can adapt the code to track other players as you see fit. This script fires when a player joins the game. 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.įor example: :Connect(function(player) This can be done be capturing the player object when they first load onto the server using a regular script somewhere in the Workspace. ( player.Character).īefore you can access the Character property, you need to get the player's object.

roblox get character from player

To get a player's position (server side) you need to access the player's character property. Roblox is very confusing, despite their claims that it is an easy way to learn scripting.






Roblox get character from player