How would I display a Billboard Gui when a player gets within 10 studs of a part named box?
Try using Magnitude
Magnitude is the Length of a Vector3
local Magnitude = (HumanoidRootPart.Position - Example.Position).Magnitude -- Distance between Part and Character
if Magnitude < 15 then -- If You are in Range
-- code to display UI
else
-- code to Remove
end
Put it in a while loop if you like
Ok, I have a list of part names where I want the Gui to display, how would I make it look for the players magnitude for all the parts in my list?
Triggers = {
1 == "Box",
2 == "Trash Can"
}
You would use a for loop
for Name, Value in pairs(Triggers) do
-- code
end
1 Like
Should I make it so in the Triggers table its somthing like 1 == game.workspace.box?
Yes