Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local UserInputService = game:GetService("UserInputService")
- local ContextActionService = game:GetService("ContextActionService")
- local function CreateNameTag(player)
- local character = player.Character or player.CharacterAdded:Wait()
- local head = character:WaitForChild("Head")
- if head:FindFirstChild("NameTag") then
- return
- end
- local billboardGui = Instance.new("BillboardGui")
- billboardGui.Name = "NameTag"
- billboardGui.Adornee = head
- billboardGui.Size = UDim2.new(0, 200, 0, 50)
- billboardGui.StudsOffset = Vector3.new(0, 2, 0)
- billboardGui.AlwaysOnTop = true
- local textLabel = Instance.new("TextLabel")
- textLabel.BackgroundTransparency = 1
- textLabel.Size = UDim2.new(1, 0, 1, 0)
- textLabel.Text = player.Name
- textLabel.Font = Enum.Font.SourceSansBold
- textLabel.TextSize = 14
- textLabel.TextColor3 = Color3.new(1, 1, 1)
- textLabel.Parent = billboardGui
- billboardGui.Parent = head
- end
- local function RefreshHighlights()
- for i, Player in pairs(Players:GetPlayers()) do
- if Player ~= Players.LocalPlayer then
- local Character = Player.Character
- if Character then
- if Character:FindFirstChildWhichIsA("Highlight") then
- Character:FindFirstChildWhichIsA("Highlight"):Destroy()
- end
- local Highlight = Instance.new("Highlight")
- Highlight.FillColor = Color3.fromRGB(255, 255, 0)
- Highlight.Parent = Character
- end
- end
- end
- end
- local function ToggleHighlight(actionName, inputState, inputObject)
- if inputState == Enum.UserInputState.Begin then
- RefreshHighlights()
- end
- end
- Players.PlayerAdded:Connect(function(player)
- CreateNameTag(player)
- RefreshHighlights()
- end)
- for _, player in pairs(Players:GetPlayers()) do
- CreateNameTag(player)
- RefreshHighlights()
- end
- if UserInputService.TouchEnabled then
- ContextActionService:BindAction("ToggleHighlight", ToggleHighlight, false, Enum.KeyCode.ButtonR1)
- end
- while wait(1) do
- RefreshHighlights()
- end
Advertisement
Add Comment
Please, Sign In to add comment