Hi. I want a BillboardGUI to be visible when you're close to it, but disappear when you get too far away.
I tried this script, but it doesnt seem to work.
local distance = (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - script.Parent.Parent.Parent.Position).magnitude
while true do wait()
if distance < 10 then
print("visible")
else
print("not visible")
end
end

1 comment
Distance is static and never changes. It needs to be in the loop to change. You can also consider MaxDistance of the GUI.