Hey,
I wanted to know how to find the closest SPECIFIC object to a player.
So I have this script:
while true do
wait()
local WorkspaceChild = workspace:GetDescendants()
for i=1, #WorkspaceChild do
local part = WorkspaceChild[i]
local Character = script.Parent
if part:IsA("Model") and part.Name=="DoorSystem" and part:FindFirstChild("Card") and part:FindFirstChild("DoorSystem1") and part:FindFirstChild("Close") then
local torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
local side1 = part:FindFirstChild("Card").side1
local side2 = part:FindFirstChild("Card").side2
local magnitude1 = (torso.Position - side1.Position).magnitude
local magnitude2 = (torso.Position - side2.Position).magnitude
end
end
-- SORT
{INSERT CLOSEST ONE HERE}.BillboardGui.Enabled =true
end
And I was wondering if I could sort all magnitudes in a table.
Thanks.