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

Billboard GUI Issue?

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.

1 answer

✓ Accepted answer
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.

2 comments

0

Tanks!

0

yw

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