local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") -- Create a folder for billboards local folder = workspace:FindFirstChild("Animals") local billboards = {} -- Table to keep track of all billboards local billboardsActive = true -- Track if billboards are active -- Function to create a billboard for each model local function createBillboard(model) local billboardGui = Instance.new("BillboardGui") local textLabel = Instance.new("TextLabel") local distanceLabel = Instance.new("TextLabel") -- Configure BillboardGui billboardGui.Adornee = model.PrimaryPart or model:FindFirstChild("HumanoidRootPart") billboardGui.Size = UDim2.new(0, 150, 0, 70) -- Increased height for visibility billboardGui.StudsOffset = Vector3.new(0, 2, 0) billboardGui.AlwaysOnTop = true -- Configure the main TextLabel for model names textLabel.Text = model.Name textLabel.Size = UDim2.new(1, 0, 0.5, 0) -- Ratio for name label textLabel.BackgroundTransparency = 1 textLabel.TextColor3 = Color3.fromRGB(255, 255, 255) textLabel.TextScaled = true -- Enable text scaling textLabel.TextStrokeTransparency = 0 -- Add stroke for better visibility textLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0) -- Black stroke for contrast textLabel.Font = Enum.Font.Garamond textLabel.Parent = billboardGui -- Configure the Distance Label distanceLabel.Size = UDim2.new(1, 0, 0.5, 0) -- Adjust height for the distance label distanceLabel.Position = UDim2.new(0, 0, 0.5, 0) -- Position below the name label distanceLabel.BackgroundTransparency = 1 distanceLabel.TextColor3 = Color3.fromRGB(255, 255, 255) -- White color for distance text distanceLabel.TextScaled = true -- Scale text distanceLabel.TextStrokeTransparency = 0 distanceLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0) distanceLabel.Font = Enum.Font.Garamond distanceLabel.Text = "Calculating..." -- Placeholder text distanceLabel.Parent = billboardGui -- Parent the BillboardGui to the model billboardGui.Parent = model table.insert(billboards, {gui = billboardGui, distanceLabel = distanceLabel, model = model}) -- Store billboard and distance label end -- Function to refresh billboards local function refreshBillboards() -- Clear existing billboards for _, billboardInfo in ipairs(billboards) do billboardInfo.gui:Destroy() -- Remove the old billboard end billboards = {} -- Reset billboard table if folder then -- Create new billboards for each model in the Animals folder for _, model in ipairs(folder:GetChildren()) do if model:IsA("Model") and (model.PrimaryPart or model:FindFirstChild("HumanoidRootPart")) then createBillboard(model) -- Create and store new billboard end end else print("Folder 'Animals' not found in Workspace.") end end -- Function to update the distance in billboards local function updateBillboards() for _, billboardInfo in ipairs(billboards) do local distanceLabel = billboardInfo.distanceLabel local model = billboardInfo.model if model and model.PrimaryPart and Character.PrimaryPart then -- Calculate the distance from the player local distance = (model.PrimaryPart.Position - Character.PrimaryPart.Position).Magnitude -- Set the distance label text distanceLabel.Text = string.format("Distance: %.2f m", distance) end end end -- Keybind to toggle billboards on/off UserInputService.InputBegan:Connect(function(input, processed) if not processed and input.KeyCode == Enum.KeyCode.V then billboardsActive = not billboardsActive -- Toggle billboards for _, billboardInfo in ipairs(billboards) do billboardInfo.gui.Enabled = billboardsActive end local status = billboardsActive and "enabled" or "disabled" print("Billboards " .. status) end end) -- Refresh billboards every 5 seconds task.spawn(function() while true do task.wait(5) -- Wait 5 seconds between refreshes if billboardsActive then refreshBillboards() end end end) -- Continuous update for billboard distances RunService.RenderStepped:Connect(function() if billboardsActive then updateBillboards() end end) -- Initial refresh of billboards refreshBillboards()