Raycast trail effect help

I want to make trails that appear on both sides of the player and are always ontop of the ground below the player through the use of raycasts but it just ends up like this:

The code:

function TengenVFX.line(args)
	for i = 1,2 do
		if i == 1 then
			local trail = script:WaitForChild("Trail"):Clone()
			trail.Parent = workspace.Junk
			
			local weld = Instance.new("Weld",trail)
			weld.Part0 = args.Pivot
			weld.Part1 = trail
			weld.C0 = CFrame.new(-2,0,0)
			
			local params = RaycastParams.new()
			params.FilterType = Enum.RaycastFilterType.Exclude
			params.FilterDescendantsInstances = {args.Pivot.Parent,workspace.Junk}
			
			runService.RenderStepped:Connect(function()
				for i,v in pairs(trail:GetChildren()) do
					if v:IsA("Attachment") then
						local result = workspace:Raycast(v.Position,v.CFrame.UpVector * -5,params)
						if result then
							v.Position = result.Position
						end
					end
				end
			end)
		else
			local trail = script:WaitForChild("Trail"):Clone()
			trail.Parent = workspace.Junk

			local weld = Instance.new("Weld",trail)
			weld.Part0 = args.Pivot
			weld.Part1 = trail
			weld.C0 = CFrame.new(2,0,0)

			local params = RaycastParams.new()
			params.FilterType = Enum.RaycastFilterType.Exclude
			params.FilterDescendantsInstances = {args.Pivot.Parent,workspace.Junk}

			runService.RenderStepped:Connect(function()
				for i,v in pairs(trail:GetChildren()) do
					if v:IsA("Attachment") then
						local result = workspace:Raycast(v.Position,v.CFrame.UpVector * -5,params)
						if result then
							v.Position = result.Position
						end
					end
				end
			end)
		end
	end
end

Are you excluding the player character?

Like @bytesleuth said, Make sure you’re excluding the player(s).
Furthermore, If this is client-sided i’d even recommend excluding the camera.

yes i am excluding the character and all
image

but through this i found out the the RenderStepped function only runs once (idk why), but its meant to constantly update the trails position, so i guess thats another bug

What are args and args.Pivot?

the args.Pivot it the HumanoidRootPart and args is just a table of information passed to the client