Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you select your character without using a LocalScript?

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.

4 comments

0

What are you trying to do? Teleport the players?

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.

0

why do you want to use a serverscript though???

0

you can get the position using a localscript too

2 answers

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

2 comments

0

Maybe get the name by using playeradded

0

How am I supposed to get the player's name?

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

This discussion is preserved as it was. New answers, comments, and votes are closed.