Basically I was making a door script and I need help. Here is the code.
local door = game.Workspace.Door
local player = -- LocalPlayer Here
local magnitude = (door.Position - player.Position).magnitude
print(magnitude)
if magnitude < 12 then
script.Parent.Frame.Visible = true
elseif magnitude > 12 then
script.Parent.Frame.Visible = false
end
What I want to know is how to find the position of localplayer and also how to make magnitude update every second so the GUI will be removed if magnitude is over 12
EDIT: I used a while true do loop and it worked.

2 comments
local player = game.Players.LocalPlayer.Character.Torso
Do I use while true do for loop every second?