So i am trying to make this BILLBOARD gui only show if the person is with in like lets say 20 sutds, can anyone help?
I've looked everywhere, tried everything i know.
So i am trying to make this BILLBOARD gui only show if the person is with in like lets say 20 sutds, can anyone help?
I've looked everywhere, tried everything i know.
camera = game.Workspace.CurrentCamera -- camera
part = -- location of the part containing the BillboardGui
game:GetService("RunService").RenderStepped:connect(function() -- refresh every 0.0167 seconds
if (camera.CoordinateFrame.p - part.Position).magnitude < 20 then -- checks if the distance is smaller than 20 studs
part.BillboardGui.Enabled = true -- makes it visible
else
part.BillboardGui.Enabled = false -- makes it invisible
end
end)
This script will check if the camera position is in the limit of 20 studs. If you want to check the character, then just change this
camera = game.Workspace.CurrentCamera -- camera
if (camera.CoordinateFrame.p - part.Position).magnitude < 20 then
for this
character = game.Players.LocalPlayer.Character
if (character.Head.Position - part.Position).magnitude < 20 then
. Magnitude is very useful.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Tanks!
yw