Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Script to highlight players visible through walls with a rainbow effect and display their names
- -- Function to create a rainbow effect
- local function rainbowColor()
- local frequency = 0.3
- local amplitude = 127
- local center = 128
- local speed = 0.1
- local r = math.sin(frequency * tick() + 0) * amplitude + center
- local g = math.sin(frequency * tick() + 2) * amplitude + center
- local b = math.sin(frequency * tick() + 4) * amplitude + center
- return Color3.fromRGB(r, g, b)
- end
- -- Main loop to update player visibility
- while true do
- wait(0.1) -- Adjust the delay based on your preference
- -- Loop through all players
- for _, player in pairs(game.Players:GetPlayers()) do
- -- Check if the player is visible through walls
- if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
- local humanoidRootPart = player.Character.HumanoidRootPart
- local playerScreenPos, visible = workspace.CurrentCamera:WorldToViewportPoint(humanoidRootPart.Position)
- -- Check if the player is visible on the screen
- if visible then
- -- Create a rainbow-colored highlight around the player
- local highlight = Instance.new("BoxHandleAdornment")
- highlight.Adornee = humanoidRootPart
- highlight.Size = Vector3.new(4, 8, 4) -- Adjust the size of the highlight
- highlight.Color3 = rainbowColor() -- Apply the rainbow effect
- highlight.Transparency = 0.5
- highlight.AlwaysOnTop = true
- highlight.ZIndex = 5
- highlight.Parent = humanoidRootPart
- -- Create a text label displaying the player's name
- local nameLabel = Instance.new("TextLabel")
- nameLabel.Text = player.Name
- nameLabel.Size = UDim2.new(0, 100, 0, 20)
- nameLabel.TextColor3 = Color3.new(1, 1, 1)
- nameLabel.BackgroundTransparency = 1
- nameLabel.Position = UDim2.new(0, 0, -1, 0) -- Adjust the position relative to the highlight
- nameLabel.Parent = highlight
- end
- end
- end
- end
Advertisement