--// Redesigned Highlight Script with GUI Toggle and Key Binding local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local StarterGui = game:GetService("StarterGui") -- Create a Screen GUI and Button local PlayerGui = Players.LocalPlayer:WaitForChild("PlayerGui") local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "HighlightToggleGui" ScreenGui.ResetOnSpawn = false ScreenGui.Parent = PlayerGui local ToggleButton = Instance.new("TextButton", ScreenGui) ToggleButton.Size = UDim2.new(0, 200, 0, 50) ToggleButton.Position = UDim2.new(1, -220, 0, 20) -- Upright position ToggleButton.Text = "Toggle Highlights" ToggleButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50) ToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255) ToggleButton.Font = Enum.Font.SourceSansBold ToggleButton.TextSize = 20 local isHighlightEnabled = false -- Function to apply highlight to a player local function ApplyHighlight(Player) local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid = Character:WaitForChild("Humanoid") -- Ensure highlight doesn't already exist local ExistingHighlight = Character:FindFirstChildOfClass("Highlight") if ExistingHighlight then return end local Highlighter = Instance.new("Highlight", Character) Highlighter.Name = "PlayerHighlight" Highlighter.FillTransparency = 0.5 Highlighter.OutlineTransparency = 0.1 local function UpdateFillColor() local DefaultColor = Color3.fromRGB(255, 48, 51) Highlighter.FillColor = Player.TeamColor and Player.TeamColor.Color or DefaultColor end UpdateFillColor() Player:GetPropertyChangedSignal("TeamColor"):Connect(UpdateFillColor) -- Remove highlight on death Humanoid.Died:Connect(function() Highlighter:Destroy() end) end -- Function to toggle highlights for all players local function ToggleHighlights() isHighlightEnabled = not isHighlightEnabled ToggleButton.Text = isHighlightEnabled and "Disable Highlights" or "Enable Highlights" for _, Player in ipairs(Players:GetPlayers()) do if isHighlightEnabled then ApplyHighlight(Player) else local Character = Player.Character if Character then local Highlighter = Character:FindFirstChild("PlayerHighlight") if Highlighter then Highlighter:Destroy() end end end end end -- Connect button click to toggle function ToggleButton.MouseButton1Click:Connect(ToggleHighlights) -- Bind ToggleHighlights to Right Alt key UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.RightAlt then ToggleHighlights() end end) -- Apply highlights to new players when enabled Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function() if isHighlightEnabled then ApplyHighlight(Player) end end) end) -- Ensure existing players are handled for _, Player in ipairs(Players:GetPlayers()) do Player.CharacterAdded:Connect(function() if isHighlightEnabled then ApplyHighlight(Player) end end) end