Could the ApplyImpulse function be causing delay in script execution?

I’m currently experiencing an issue in my Roblox game where there is a delay between the execution of my script and the touch of my sphere. I’m unsure if the problem is caused by my use of the ApplyImpulse function.

local ball = script.Parent

local counter = 0


	if hit.Parent:FindFirstChild("Humanoid") then

		ball:ApplyImpulse(hit.CFrame.LookVector.Unit * 3000)
		print(counter, ": ", hit.CFrame.LookVector.Unit * 3000)
		counter += 1



The script in question uses ApplyImpulse to apply a force to the sphere in order to move it. The sphere is set to be transparent and the lookvector is used to determine the direction of the impulse. Despite my efforts to troubleshoot and debug the problem, I have been unable to find the cause of the delay. I have included a video that illustrates the problem in more detail.

If anyone has any experience with similar issues or has any suggestions, I would greatly appreciate it. I’m trying to find a way to eliminate the delay and improve the overall performance of my game.

Is it possibly that ApplyImpulse is causing the problem or is it something else?

Any feedback would be greatly appreciated. Thank you in advance.

1 Like

I believe it would be something more related to NetworkOwnership, the lag is most likely just the ping between the server and client.

You could instead try doing the movement forces on the client, and have a server script set the NetworkOwner of the ball to Auto (with SetNetworkOwnershipAuto()), so it works with the client script.

So you want me to send a remote event to the function when the ball is touched? Or should I look for local touches? I feel like this would make it easier to cheat, is that a possibility?

If you’re talking about the NetworkOwner, you’ll only need to run SetNetworkOwnerAuto() once. If you’re talking about the movement forces, yes, you’ll have to locally listen for touches, and locally apply the forces.

This should reflect to the server, as the player should be the network owner the moment they touch the ball.

Yes. And it will likely happen. Unfortunately, there isn’t much that can be done, without sacrificing smoothness.

Okay thanks for the quick response. I’ll look into it.

1 Like

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