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

I cannot figure out how to reference the LocalPlayers Position and put it in a variable fix? [FIXED]

I know this is probably really easy to do, but I want to have this brick go to the position of the player. Code V



local player = game.Players.LocalPlayer

local playerpos = game.Players.LocalPlayer.Character.Torso.Position
	

	script.Parent.Position = playerpos
	wait(0.5)
	

2 comments

0

Is this in a ServerScript or LocalScript?

0

Because you can't reference the player in a ServerScript, only LocalScript.

2 answers

✓ Accepted answer

Don't use torso as the position. Always use HumanoidRootPart.

local player = game.Players.LocalPlayer

local playerpos = game.Players.LocalPlayer.Character.HumanoidRootPart


workspace["PART NAME HERE"].Position = Vector3.new(playerpos)
wait(0.5)

Put that inside a local script inside StarterGui.

1 comment

0

It says " HumanoidRootPart is not a valid member of Model"

Here ya go!

local player = game.Players.LocalPlayer

local playerpos = game.Players.LocalPlayer.Character.Torso.Position


    script.Parent.Position = Vector3.new(playerpos)
    wait(0.5)

1 comment

0

It doesn't give me a error on nothing, it just stays exactly where it is.

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