Projectile does not always move (Network Ownership)

try disabling ForceLimitMode.PerAxis and just keep force on all axis the same until impact.

Seems like it’s auto-selecting to Magnitude, and the issue still persists.

would it be possible for you to record a side view of the projectile? id like to see if the downwards motion is curved or straight.

also just to make sure but when you parent the ball to the workspace to be moved it is being positioned before or after that? from past experience I noticed that if the physics simulation takes place a frame or two before any bodymovers start acting then it can mess with projectile accuracy.

if all else fails you could send me the ball tool by itself in a blank baseplate save, then send it as a link. from there I can look at it myself and see what that issue is.

Sorry, once again, for the very late reply. The issue still occurs with LinearVelocity, so I think the network ownership might be automatically getting set to server before I set it to the client, which means the velocity is already gone before it has a chance to work (it’s there for a very short amount of time). I have implemented this code:

task.spawn(function()
		while clonedBall.Parent ~= nil do
			if clonedBall:GetNetworkOwner() == nil then
				clonedBall:SetNetworkOwner(player)
			end
			task.wait(0.3)
		end
	end)

I won’t go to LinearVelocity for now, because like I said, the issue still occurs.

It’s definitely to do with the Network Ownership, because the issue doesn’t happen when I set the network owner to the server, but there’s a delay with the velocity (the ball freezes and then moves). I tried using SetNetworkOwnershipAuto(), it reduced the issue, but it still happened. If you have any ideas, I’d be happy to hear them, this is really annoying now…

Code snippet:

    local clonedBall = getBall(player)
	clonedBall:AddTag("Ball")
	
	if player.Team == teams.Dead then
		clonedBall.Color = Color3.fromRGB(0, 0, 0)
	elseif player.Team == teams.Blue then
		clonedBall.Color = Color3.fromRGB(0, 0, 127)
	elseif player.Team == teams.Red then
		clonedBall.Color = Color3.fromRGB(170, 0, 0)
	end
	
	--physics
	local velocity = Instance.new("BodyVelocity")
	velocity.Parent = clonedBall
	velocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	velocity.Velocity = (mouseFrame.LookVector * range * speed + Vector3.new(0, height, 0))
	
	local handle
	if player.Backpack:FindFirstChild("BallThrow") then
		handle = player.Backpack.BallThrow.Handle
	elseif player.Character:FindFirstChild("BallThrow") then
		handle = player.Character.BallThrow.Handle
	else
		handle = starterPack.BallThrow.Handle
	end
	
	if handle:FindFirstChildOfClass("Fire") then
		local colour = handle.Fire.Color
		handle.Fire:Destroy()
		local fire:Fire = Instance.new("Fire")
		fire.Parent = clonedBall
		fire.Color = colour
		fire.TimeScale = 1
		fire.Heat = 50
	end
	
	clonedBall:SetNetworkOwnershipAuto()
	
	clonedBall.CanTouch = true

    --ignore this line
	task.spawn(castRayFromBall, clonedBall, mouseFrame.LookVector, player.Character, speed, handle)


	task.wait(1 / speed)
	clonedBall.CanCollide = true
	velocity:Destroy()
	task.wait(1 - (1 / speed))
	player.CanThrow.Value = true

After ages, I finally solved it and the solution does not include a deprecated feature or the unreliability of LinearVelocity! I made this post for anyone else who might find it helpful. These scripts are outdated anyway now, I have since used a more modular and Object-Oriented approach.

I just set the AssemblyLinearVelocity of the part, it also takes a Vector3 so it was incredibly easy to convert it. As for the not throwing issue, I just needed to reduce the strain on client memory. Now I know what the issue is, it shouldn’t be too much harder to fix.

Thanks @mantorok4866 for your help :smiley: .

2 Likes

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