Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local lootFolder = game.Workspace:WaitForChild("Loot")
- local carsFolder = game.Workspace:WaitForChild("Cars")
- local function addVisuals(item, color, showFuel)
- if item:IsA("Model") and item.PrimaryPart then
- local highlight = Instance.new("Highlight")
- highlight.Parent = item
- highlight.Adornee = item
- highlight.FillColor = color
- highlight.OutlineColor = Color3.fromRGB(255, 255, 255)
- highlight.FillTransparency = 0.5
- highlight.OutlineTransparency = 0
- local billboard = Instance.new("BillboardGui")
- billboard.Parent = item.PrimaryPart
- billboard.Adornee = item.PrimaryPart
- billboard.Size = UDim2.new(0, 80, 0, 14)
- billboard.StudsOffset = Vector3.new(0, 2.5, 0)
- billboard.AlwaysOnTop = true
- local label = Instance.new("TextLabel")
- label.Parent = billboard
- label.Size = UDim2.new(1, 0, 1, 0)
- label.BackgroundTransparency = 1
- label.TextColor3 = color
- label.Font = Enum.Font.SourceSans
- label.TextSize = 8
- label.TextScaled = false
- if showFuel then
- local function updateLabel()
- local fuelValue = item:GetAttribute("Fuel") or 0
- label.Text = item.Name .. " | Fuel: " .. fuelValue
- end
- updateLabel()
- item:GetAttributeChangedSignal("Fuel"):Connect(updateLabel)
- else
- label.Text = item.Name
- end
- elseif item:IsA("MeshPart") then
- local highlight = Instance.new("Highlight")
- highlight.Parent = item
- highlight.Adornee = item
- highlight.FillColor = Color3.fromRGB(0, 255, 0)
- highlight.OutlineColor = Color3.fromRGB(255, 255, 255)
- highlight.FillTransparency = 0.5
- highlight.OutlineTransparency = 0
- local billboard = Instance.new("BillboardGui")
- billboard.Parent = item
- billboard.Adornee = item
- billboard.Size = UDim2.new(0, 50, 0, 10)
- billboard.StudsOffset = Vector3.new(0, 1.5, 0)
- billboard.AlwaysOnTop = true
- local label = Instance.new("TextLabel")
- label.Parent = billboard
- label.Size = UDim2.new(1, 0, 1, 0)
- label.BackgroundTransparency = 1
- label.TextColor3 = Color3.fromRGB(0, 255, 0)
- label.Font = Enum.Font.SourceSans
- label.TextSize = 8
- label.TextScaled = false
- label.Text = item.Name
- end
- end
- -- Loot klasöründeki modellere uygula (Fuel sadece Jerrycan'da gösterilecek)
- for _, item in ipairs(lootFolder:GetDescendants()) do
- if item:IsA("Model") then
- local showFuel = (item.Name == "Jerrycan")
- addVisuals(item, Color3.fromRGB(170, 0, 255), showFuel) -- Mor renk
- elseif item:IsA("MeshPart") then
- addVisuals(item, nil, false)
- end
- end
- -- Cars klasöründeki modellere uygula (hepsi kırmızı, Fuel göster)
- for _, car in ipairs(carsFolder:GetDescendants()) do
- if car:IsA("Model") then
- addVisuals(car, Color3.fromRGB(255, 0, 0), true) -- Kırmızı, Fuel göster
- end
- end
- -- Sonradan eklenenler için
- lootFolder.DescendantAdded:Connect(function(item)
- if item:IsA("Model") then
- local showFuel = (item.Name == "Jerrycan")
- addVisuals(item, Color3.fromRGB(170, 0, 255), showFuel)
- elseif item:IsA("MeshPart") then
- addVisuals(item, nil, false)
- end
- end)
- carsFolder.DescendantAdded:Connect(function(item)
- if item:IsA("Model") then
- addVisuals(item, Color3.fromRGB(255, 0, 0), true)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement