Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you select your character without using a LocalScript?

Asked by 6 years ago
Edited 6 years ago

How do I select my character without using a LocalScript but by using a normal Script, I need this so I can select the HumanoidRootPart and get the position of it. The script is in Workspace btw.

0
What are you trying to do? Teleport the players? GIassWindows 141 — 6y
0
No I'm trying to get the player's position so I can get the distance between the player and a part. I know how to get the position between 2 parts in Workspace but not between 1 part and the player. ShiforRBLX 5 — 6y
0
why do you want to use a serverscript though??? GIassWindows 141 — 6y
0
you can get the position using a localscript too GIassWindows 141 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

get the name of the player somehow first, then simply select it.

the character model is server-sided, so both local and normal scripts can access it

local playermodel = game.Workspace:FindFirstChild(NAME)

then for the root's position:

local pos = playermodel.PrimaryPart.CFrame

put a .p at the end of the code mentioned above if you would prefer a vector3 or put .Position

0
Maybe get the name by using playeradded GIassWindows 141 — 6y
0
How am I supposed to get the player's name? ShiforRBLX 5 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

I don't get why you don't want to use a localscript but ok.

LocalScript:

game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame

ServerScript:

game.Players.PlayerAdded:connect(function(player)
    player.Character.HumanoidRootPart.CFrame
end

Answer this question