Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RunService = game:GetService("RunService")
- local player = game:GetService("Players").LocalPlayer
- local stepTime = 5
- local Blacklist = { --//Blacklist because I don't know the ServerStorage names of some Trees/Ores
- --//Ores
- "Stone_Rock"; "Coal_Rock"; "Copper_Rock"; "Iron_Rock"; "Silver_Rock"; "Gold_Rock"; "Tourmaline_Rock"; "Ruby_Rock"; "Sapphire_Rock"; "Topaz_Rock"; "Emerald_Rock"; "Diamond_Rock"; "Amethyst_Rock"; "Cinnabar_Rock";
- --//Trees
- "Light_Tree"; "Normal_Tree"; "Strong_Tree"; "Maple_Tree"; "Dead_Tree"; "Blood_Tree"; "Acid_Tree"; "Magma_Tree"; "Magic_Tree"; "Corrupted_Tree";
- --//Misc
- "Fish"; "Crates"; "Monsters";
- }
- local function CreateGui(MainPart)
- if MainPart.Parent.Properties.Alive.Value == true then
- local BillboardGui = Instance.new("BillboardGui")
- local TextLabel = Instance.new("TextLabel")
- BillboardGui.Parent = MainPart
- BillboardGui.AlwaysOnTop = true
- BillboardGui.LightInfluence = 1
- BillboardGui.Size = UDim2.new(0, 100, 0, 100)
- BillboardGui.StudsOffset = Vector3.new(0, 2, 0)
- BillboardGui.Adornee = MainPart
- TextLabel.Parent = BillboardGui
- TextLabel.BackgroundTransparency = 1
- TextLabel.Size = UDim2.new(1.5, 0, 3, 0)
- TextLabel.TextColor3 = Color3.new(255, 44, 44)
- coroutine.resume(coroutine.create(function()
- local Stepped
- Stepped = RunService.RenderStepped:Connect(function()
- TextLabel.Text = tostring(MainPart.Parent.Name.. " [" ..tonumber((player.Character.HumanoidRootPart.Position - MainPart.Position).Magnitude).. "]")
- if MainPart.Parent.Properties.Alive.Value == false then
- Stepped:Disconnect()
- end
- end)
- end))
- TextLabel.TextScaled = true
- coroutine.resume(coroutine.create(function()
- repeat wait(1) until MainPart.Parent.Properties.Alive.Value == false
- BillboardGui:Destroy()
- end))
- end
- end
- local lastTime = 0
- RunService.Heartbeat:Connect(function()
- if tick() - lastTime >= stepTime then
- lastTime = tick()
- for _, v in pairs(game.workspace.Resources:GetDescendants()) do
- if v:IsA("Model") and v.PrimaryPart ~= nil and not v.PrimaryPart:FindFirstChild("BillboardGui") then
- if not table.find(Blacklist, v.Name) and not table.find(Blacklist, v.Parent.Name) then
- CreateGui(v.PrimaryPart)
- end
- end
- end
- end
- end)
Add Comment
Please, Sign In to add comment