Linear Velocity Lag?

This is my first time using linear velocity as a method for projectiles and just in general and I’ve ran into a problem. Currently I’m trying to use linear velocity to throw a snowball to my mouse cursor. However, the snowball lags sometimes when I’m throwing it and I have no idea why. It’s a cloned snowball part that I’m throwing forward, so I don’t know if it has anything to do with it.

I’ve also realized that it only happens for a while when I join the game. I think the problem goes away after a while, but it seems like when I throw the snowball when I’m new to the server it lags a bit.

Snowball Part Lag

No SnowBall Lag

Script

local function SnowBallEquipped(LocalPlayer, active, mouse)
	local Character = LocalPlayer.Character
	local Humanoid = Character:WaitForChild("Humanoid")
	local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
	local LookVector = Character:WaitForChild("HumanoidRootPart").CFrame.LookVector

	
	if active == true then
		local SnowBall = ReplicatedStorage:WaitForChild("SnowBall")
		local Box2 = ReplicatedStorage:WaitForChild("Box2")
		local Box3 = ReplicatedStorage:WaitForChild("Box3")
		local Animation1 = Humanoid:LoadAnimation(Animation.Create)
		Animation1:Play()
		task.wait(0.3)
		
		local SnowBallClone = SnowBall:Clone()
		local Box2Clone = Box2:Clone()
		local Box3Clone = Box3:Clone()
		
		local SnowBallSpawnSound = Instance.new("Sound", SnowBallClone)
		SnowBallSpawnSound.SoundId = "rbxassetid://9125640609"
		SnowBallSpawnSound.RollOffMaxDistance = 100
		SnowBallSpawnSound.Volume = 7
		SnowBallSpawnSound.Name = "SnowBall Spawn"
		SnowBallSpawnSound:Play()
		SnowBallClone.Parent = game.Workspace
		Box2Clone.Parent = SnowBallClone
		Box3Clone.Parent = SnowBallClone
		
		local MagicChimeSound  = Instance.new("Sound", Box2Clone)
		MagicChimeSound.SoundId = "rbxassetid://9116394876"
		MagicChimeSound.RollOffMaxDistance = 100
		MagicChimeSound.Volume = 7
		MagicChimeSound.Name = "Snowball Chime"
		MagicChimeSound:Play()
		
		
		local SnowBallTween = TweenInfo.new(0.3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
		local SnowBallProp = {Size = SnowBallClone.Size + Vector3.new(0.8,0.8,0.8)}
		local SnowBallCreate = TweenService:Create(SnowBallClone, SnowBallTween, SnowBallProp)
		SnowBallCreate:Play()
	
		
		SnowBallClone.Position = HumanoidRootPart.Parent.RightHand.Position + Vector3.new(0,3,0)
		Box2Clone.Position = SnowBallClone.Position + Vector3.new(0,0,0)
		Box3Clone.Position = Box2Clone.Position + Vector3.new(0,0,0)
		SnowBallClone.Anchored = true
		
		task.wait(1)
		
		local distance = (SnowBallClone.Position - HumanoidRootPart.Parent.RightHand.Position).Magnitude
		SnowBallClone.Anchored = false
		
		local LerpSound = Instance.new("Sound", SnowBallClone)
		LerpSound.SoundId = "rbxassetid://9126284551"
		LerpSound.RollOffMaxDistance = 100
		LerpSound.Name = "Lerp Sound"
		LerpSound.Volume = 100
		LerpSound:Play()
		
		local function lerp(a,b, t)
			return a + (b-a) * t
		end
		
		for i = 0, distance, 1  do
			local t = i/distance
			SnowBallClone.Transparency = 0
			SnowBallClone.Position = lerp(SnowBallClone.Position, HumanoidRootPart.Parent.RightHand.Position, t)
			task.wait(0.030)
		end
		
		local newWeld = Instance.new("Weld", HumanoidRootPart.Parent.RightHand)
		newWeld.Part0 = HumanoidRootPart.Parent.RightHand
		newWeld.Part1 = SnowBallClone
		newWeld.C0 = CFrame.new()
		newWeld.C1 = CFrame.new()
		
		Debris:AddItem(Box2Clone,1)
		Debris:AddItem(Box3Clone,1)
		
		task.wait(0.9)
	elseif active == false then	
		
		
		local Throw = Humanoid:LoadAnimation(Animation.Throw)
		Throw:Play()
		local WeldC =  HumanoidRootPart.Parent.RightHand:FindFirstChild("Weld")
		WeldC:Destroy()
		local SnowBallC = game.Workspace:FindFirstChild("SnowBall")
	
		local LinearVelocity = Instance.new("LinearVelocity", SnowBallC)
		local Attachment = Instance.new("Attachment", SnowBallC)
		LinearVelocity.Attachment0 = Attachment
		LinearVelocity.VectorVelocity = (SnowBallC.Position - mouse).Unit * -100
		LinearVelocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
		LinearVelocity.MaxForce = 10000
		LinearVelocity.RelativeTo = Enum.ActuatorRelativeTo.World

		
		local ThrowSound = Instance.new("Sound", HumanoidRootPart)
		ThrowSound.SoundId = "rbxassetid://608600954"
		ThrowSound.Volume = 5
		ThrowSound.Name = "Throw Sound"
		ThrowSound.RollOffMaxDistance = 100
		ThrowSound:Play()
		Debris:AddItem(ThrowSound, 2)
		Debris:AddItem(SnowBallC,2.1)

	end
end

I don’t see anything particularly wrong with your code, however I do have a few ideas on why this is happening.

Like you said, it only happens at the initial loading time of the player; Maybe ROBLOX’s physics engine is not yet initialized.

Though, I would recommend when making objects move; that you move them using RunService if you want them to move regardless of the current FPS of the client.

In this case you should use Runservice.Heartbeat for a physics operation.

Additional help: RenderStepped, Stepped, or Heartbeat