local Players = game:GetService("Players") local RunService = game:GetService("RunService") local TARGET_GUN_NAME = "MatchGun" local BEAM_THICKNESS = 0.1 local MAX_DIST = 500 local ROTATION_OFFSET = CFrame.Angles(0, math.rad(90), 0) local function updateTracer(player) local character = player.Character if not character then return end local matchGun = character:FindFirstChild(TARGET_GUN_NAME, true) local barrel = nil if matchGun then local model = matchGun:FindFirstChild("Model") barrel = model and model:FindFirstChild("Barrel") end local tracerName = player.Name .. "_Tracer" local existingTracer = workspace:FindFirstChild(tracerName) if not barrel or not barrel:IsDescendantOf(workspace) then if existingTracer then existingTracer:Destroy() end return end if not existingTracer then existingTracer = Instance.new("Part") existingTracer.Name = tracerName existingTracer.Material = Enum.Material.Neon existingTracer.CanCollide = false existingTracer.Anchored = true existingTracer.Parent = workspace end local shootFrame = barrel.CFrame * ROTATION_OFFSET local rayDir = shootFrame.LookVector * MAX_DIST local rayParams = RaycastParams.new() rayParams.FilterDescendantsInstances = {character, existingTracer} rayParams.FilterType = Enum.RaycastFilterType.Exclude local result = workspace:Raycast(barrel.Position, rayDir, rayParams) local beamLen = MAX_DIST local hitColor = Color3.fromRGB(255, 0, 0) if result then beamLen = result.Distance local hitChar = result.Instance:FindFirstAncestorOfClass("Model") if hitChar and hitChar:FindFirstChild("Humanoid") then local hitPlayer = Players:GetPlayerFromCharacter(hitChar) if hitPlayer and hitPlayer ~= player then hitColor = Color3.fromRGB(255, 255, 0) local hum = hitChar:FindFirstChild("Humanoid") if hum then hum.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff end end end end existingTracer.Size = Vector3.new(BEAM_THICKNESS, BEAM_THICKNESS, beamLen) existingTracer.Color = hitColor existingTracer.CFrame = shootFrame * CFrame.new(0, 0, -beamLen / 2) end RunService.RenderStepped:Connect(function() for _, player in ipairs(Players:GetPlayers()) do updateTracer(player) local char = player.Character if char then for _, p in ipairs(char:GetDescendants()) do if p:IsA("BasePart") or p:IsA("Decal") then if p.Name == "HumanoidRootPart" then p.Transparency = 1 else p.Transparency = 0 end end end end end end)