:ApplyImpulse() not working, no matter what I try

I stumbled upon :ApplyImpulse(Vector3) on a forum post, and tried it, but it didn’t work, so I looked up the roblox documentation for it. This is what it says:

This function applies an instant force impulse to this part's assembly.

The force is applied at the assembly's center of mass, so the resulting movement will only be linear.

The resulting velocity from the impulse relies on the assembly's mass. So a higher impulse is required to move more massive assemblies. Impulses are useful for cases where you want a force applied instantly, such as an explosion or collision.

If the part is owned by the server, this function must be called on a server Script. If the part is owned by a client, this function can be called on a LocalScript or server Script.

It gives no script examples, and is pretty minimal in its explanation.

This was my code to try and launch my character backwards:

local backwardsVelocity = -(plr.Character.HumanoidRootPart.CFrame.LookVector * 2);

At first, I thought I wasn’t applying enough force, so I tried:

local backwardsVelocity = -(plr.Character.HumanoidRootPart.CFrame.LookVector * 200);

When this didn’t work, I started to get triggered, and used math.huge instead:

local backwardsVelocity = -(plr.Character.HumanoidRootPart.CFrame.LookVector * math.huge);

To be honest, I actually expected this to finally work—but alas, my character hasn’t moved an inch. Am I doing something wrong?

Basically it works on your character only if you’re floating, if you’re on the ground it won’t work. Yeah i’ve never understood the point of it.

That’s weird…

But that’s also not true—at least, based on what I’ve tested.

After reading your comment, I put this code:

plr.Character.HumanoidRootPart.CFrame += Vector3.new(0, 20, 0);
local backwardsVelocity = -(plr.Character.HumanoidRootPart.CFrame.LookVector * math.huge);

Going on the premise that, as long as the character is in the air, :ApplyImpulse() should work, my character should be launched backwards, right?

Nothing happened.

As far as I remember when I tried using it, using it after I jumped actually worked, you should try that too. Anyways the best alternative to this problem is simply to add velocity to the part’s AssemblyLinearVelocity.

Type in to Google “how to calculate force for applyimpulse Roblox” to correctly apply impulse you have to first calculate the force and multiply it by the assembly mass…

Also apply impulse won’t work if you haven’t set network owner to nil or to a player

This actually already crossed my mind.

First, I set the networkowner to the server, then unanchored the HumanoidRootPart on the server, in case the game thought it was anchored.

Second, I multiplied the direction of the CFrame.LookVector by math.huge, so there’s no room for calculation error. My character didn’t move whether I used math.huge or not. I just used AssemblyLinearVelocity in the end, which was a mediocre solution.

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