AssemblyLinearVelocity stops getting applied to Projectile after certain time

Hi, I have encountered what I believe to be a bug with Velocity recently.

What happens is that after 100-120 seconds pass the AssemblyLinearVelocity won’t be applied to Projectile, there are no errors in Output, here’s the ServerScript responsible for applying the AssemblyLinearVelocity:

" local StarCount = script.Parent.Parent:WaitForChild(“StarCount”)

ProjectileSpeed = 50

script.Parent.OnServerEvent:Connect(function(who,MouseHitPos)
local char = who.Character
local HumRootPart = char.HumanoidRootPart
if not char:FindFirstChild(“Star”…StarCount.Value) then return end

local Projectile = char:FindFirstChild("Star"..StarCount.Value) 
if Projectile then Projectile.Activated.Value = 1 

	if Projectile:FindFirstChild("SpinScript") then
		Projectile.SpinScript:Destroy() 
	end

	if not Projectile:FindFirstChild("BodyForce") then

		local NewForce = Instance.new("BodyForce")
		NewForce.Force = Vector3.new(0,workspace.Gravity * Projectile:GetMass(),0) 
		NewForce.Parent = Projectile 
	end	
end	

Projectile.Anchored = false
Projectile.AssemblyLinearVelocity  = CFrame.new(HumRootPart.Position,MouseHitPos).LookVector * ProjectileSpeed 
if char:FindFirstChild("starBed"..Projectile.Id.Value) then
	char:FindFirstChild("starBed"..Projectile.Id.Value):Destroy()
end

end) "

I tried to look up the solution on Developer Hub but couldn’t find any, I also tried to locate the issue with printing everything but with no success.

Please let me know if anyone else has experienced something like this before.

1 Like

I actually found a way to fix it, turns out the part you want to apply the Velocity to can’t be in player’s Character.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.