Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Create a function to highlight and add a box to players
- local function highlightPlayers(player)
- -- Ensure the player is in the game and their character is loaded
- if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
- -- Create a Highlight object
- local highlight = Instance.new("Highlight")
- highlight.Parent = player.Character
- highlight.Adornee = player.Character
- highlight.FillColor = Color3.fromRGB(255, 0, 0) -- Red color, you can change this
- highlight.OutlineColor = Color3.fromRGB(255, 255, 255) -- White outline, you can change this
- highlight.FillTransparency = 0.5
- highlight.OutlineTransparency = 0.5
- -- Create a SelectionBox to add a box around the player
- local selectionBox = Instance.new("SelectionBox")
- selectionBox.Parent = player.Character
- selectionBox.Adornee = player.Character
- selectionBox.SurfaceColor3 = Color3.fromRGB(0, 255, 0) -- Green box, you can change this
- selectionBox.SurfaceTransparency = 0.5
- selectionBox.LineThickness = 0.1
- end
- end
- -- Call the function to highlight and add boxes to all players already in the game
- for _, player in pairs(game:GetService("Players"):GetPlayers()) do
- highlightPlayers(player)
- end
- -- Call the function to highlight and add boxes to new players when they join
- game:GetService("Players").PlayerAdded:Connect(function(player)
- player.CharacterAdded:Connect(function()
- highlightPlayers(player)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement