Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local localPlayer = Players.LocalPlayer
- -- Create ESP label for a player
- local function createRoleLabel(player)
- local char = player.Character
- if not char or not char:FindFirstChild("HumanoidRootPart") then return end
- -- Remove old ESP if it exists
- local oldESP = char:FindFirstChild("RoleESP")
- if oldESP then oldESP:Destroy() end
- local billboard = Instance.new("BillboardGui")
- billboard.Name = "RoleESP"
- billboard.Adornee = char:FindFirstChild("HumanoidRootPart")
- billboard.Size = UDim2.new(0, 100, 0, 40)
- billboard.StudsOffset = Vector3.new(0, 3, 0)
- billboard.AlwaysOnTop = true
- billboard.Parent = char
- local label = Instance.new("TextLabel")
- label.Size = UDim2.new(1, 0, 1, 0)
- label.BackgroundTransparency = 1
- label.TextColor3 = Color3.fromRGB(255, 255, 0)
- label.TextStrokeTransparency = 0.5
- label.Font = Enum.Font.GothamBold
- label.TextScaled = true
- label.Text = "Unknown"
- label.Parent = billboard
- local roleValue = player:FindFirstChild("Role")
- if roleValue then
- label.Text = roleValue.Value
- roleValue:GetPropertyChangedSignal("Value"):Connect(function()
- label.Text = roleValue.Value
- end)
- end
- end
- -- Add ESP to all current players
- local function refreshESP()
- for _, player in ipairs(Players:GetPlayers()) do
- if player ~= localPlayer then
- if player.Character then
- createRoleLabel(player)
- end
- player.CharacterAdded:Connect(function()
- wait(1)
- createRoleLabel(player)
- end)
- end
- end
- end
- -- When new players join
- Players.PlayerAdded:Connect(function(player)
- player.CharacterAdded:Connect(function()
- wait(1)
- createRoleLabel(player)
- end)
- end)
- -- Run it once on existing players
- refreshESP()
Advertisement
Add Comment
Please, Sign In to add comment