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

Billboard GUI Issue?

Asked by 10 years ago

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

Log in to vote
1
Answered by
Tesouro 407 Moderation Voter
10 years ago
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.

0
Tanks! colefrickz 0 — 10y
0
yw Tesouro 407 — 10y
Ad

Answer this question