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

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

Asked by 4 years ago
Edited 4 years ago

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)
0
Is this in a ServerScript or LocalScript? killerbrenden 1537 — 4y
0
Because you can't reference the player in a ServerScript, only LocalScript. killerbrenden 1537 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

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.

0
It says " HumanoidRootPart is not a valid member of Model" calenmaster1 31 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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)
0
It doesn't give me a error on nothing, it just stays exactly where it is. calenmaster1 31 — 4y

Answer this question