AssemblyLinearVelocity not working

Trying to use projectile physics to apply a force to a ball for a soccer game. Following a yt tutorial where the code works flawlessly, but mine doesn’t. For some reason, when I create a part and apply the force to the part, it moves, but the ball doesn’t. Here’s my code:

Remotes.ShootBall.OnServerEvent:Connect(function(player: Player, force: Vector3)
	local ball: Part = GameValues.Objects.Ball.Value
	
	Events.LosePossession:Fire(player)
	Events.UnfreezePlayer:Fire(player)
	
	ball:SetNetworkOwner(nil)
	ball.AssemblyLinearVelocity = force
	

    --The code below works for some reason??--

	--[[local part = Instance.new("Part")
	part.Shape = "Ball"
	part.Size = Vector3.new(2,2,2)
	part.CanCollide = false
	part.Position = ball.Position
	part.Parent = workspace
	part.AssemblyLinearVelocity = force--]]

end)

The force calculation:

	local direction = (shotAim.Position - ballPosition.Position)
	local duration = 1
	local force = direction/duration + Vector3.new(0, workspace.Gravity * duration * 0.5, 0)
2 Likes

make your ball is not anchored

:SetNetworkOnwer(nil) may be doing funky stuff
try removing it and see if it works

My ball is anchored --min chars

Tried removing it, the outcome is still the same

My solution: For some reason if I set the ball’s assemblylinearvelocity to the force, and make a dummy part that has the exact same position as the ball and the same assemblylinearvelocity, the ball will move. Not the most ideal, but it works.

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