Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This script can be run in the Roblox Studio's command bar (console)
- local Players = game:GetService("Players")
- local Workspace = game:GetService("Workspace")
- local RunService = game:GetService("RunService")
- local localPlayer = Players.LocalPlayer
- -- Table to hold active tracers for all players
- local activeTracers = {}
- -- Function to create or update the tracer for a player
- local function createOrUpdateTracer(player)
- local character = player.Character
- if character then
- local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
- if humanoidRootPart then
- -- Check if tracer already exists for this player
- if not activeTracers[player] then
- -- Create a new tracer part
- local tracer = Instance.new("Part")
- tracer.Size = Vector3.new(0.1, 0.1, 1) -- Set initial size (thin and long)
- tracer.Anchored = true
- tracer.CanCollide = false
- tracer.Material = Enum.Material.Neon
- tracer.BrickColor = BrickColor.new("Blue") -- Tracer color
- tracer.Transparency = 0.5 -- Semi-transparent
- tracer.Parent = Workspace
- -- Store the tracer in the activeTracers table
- activeTracers[player] = tracer
- end
- -- Update the tracer's position and orientation based on your position and the player's position
- local tracer = activeTracers[player]
- local playerPosition = humanoidRootPart.Position
- local myPosition = localPlayer.Character:FindFirstChild("HumanoidRootPart").Position
- local direction = (playerPosition - myPosition).unit
- local distance = (playerPosition - myPosition).Magnitude
- -- Update the tracer's size and position based on distance
- tracer.Size = Vector3.new(0.1, 0.1, distance) -- Stretch the tracer to the player's position
- tracer.CFrame = CFrame.new(myPosition, playerPosition) * CFrame.new(0, 0, -distance / 2) -- Position tracer at midpoint between your position and the player
- end
- end
- end
- -- Function to create or update highlights for all players
- local function createOrUpdateHighlights()
- for _, player in ipairs(Players:GetPlayers()) do
- if player ~= localPlayer then
- local character = player.Character
- if character then
- -- Check if a highlight already exists for this player
- local existingHighlight = character:FindFirstChildOfClass("Highlight")
- if not existingHighlight then
- local highlight = Instance.new("Highlight")
- highlight.Adornee = character -- Set the adornee to the player's character
- highlight.FillColor = Color3.fromRGB(0, 255, 0) -- Green color
- highlight.FillTransparency = 0.5 -- Semi-transparent fill
- highlight.OutlineColor = Color3.fromRGB(255, 255, 0) -- Yellow outline
- highlight.OutlineTransparency = 0.3 -- Semi-transparent outline
- highlight.Parent = character
- end
- end
- end
- end
- end
- -- Continuously update the tracers and highlights
- RunService.Heartbeat:Connect(function()
- createOrUpdateHighlights()
- for _, player in ipairs(Players:GetPlayers()) do
- if player ~= localPlayer then
- createOrUpdateTracer(player)
- end
- end
- end)
- -- Cleanup tracers when players leave
- Players.PlayerRemoving:Connect(function(player)
- if activeTracers[player] then
- activeTracers[player]:Destroy()
- activeTracers[player] = nil
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment