I’m trying to find a way to use the player’s position for a variable in a script, but I don’t know how to fetch the position and use it in that script.
local pos = player.Character.HumanoidRootPart.Position
or
local pos = game.Workspace:WaitForChild(player.Name).HumanoidRootPart.Position
If you use the first one, you may want to do
plr.CharacterAdded:Wait()
local pos = plr.Character.HumanoidRootPart.Position
if the script is run when the game loads
That is a way to get the player’s position, but the script won’t understand what player
is. In order to create that variable/parameter, you could do this:
local player = game.Players.LocalPlayer
local plrChar = player.Charachter
local plrPos = plrChar.HumanoidRootPart.Position
-- these are only the variables
I said that assuming they had a player
variable