Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to create a Highlight object if it doesn't exist
- local function ensureHighlight(instance)
- local highlight = instance:FindFirstChildOfClass("Highlight")
- if not highlight then
- highlight = Instance.new("Highlight")
- highlight.Parent = instance
- end
- return highlight
- end
- -- Function to update the color of all highlights
- local function updateHighlightColors()
- local hue = tick() % 5 / 5 -- Change the color over time
- local color = Color3.fromHSV(hue, 1, 1) -- Create a rainbow color
- -- Update player highlights
- for _, player in pairs(game.Players:GetPlayers()) do
- local character = player.Character
- if character then
- local highlight = ensureHighlight(character)
- highlight.FillColor = color
- highlight.OutlineColor = color
- end
- end
- -- Update NPC highlights
- local npcFolder = game.Workspace:FindFirstChild("NPCs")
- if npcFolder then
- for _, npc in pairs(npcFolder:GetChildren()) do
- if npc:IsA("Model") then
- local highlight = ensureHighlight(npc)
- highlight.FillColor = color
- highlight.OutlineColor = color
- end
- end
- end
- end
- -- Update colors continuously
- game:GetService("RunService").RenderStepped:Connect(updateHighlightColors)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement