[SOLVED] :ApplyImpulse not working

  1. What do you want to achieve? Keep it simple and clear!

I’m a bit confused on how :ApplyImpulse functions. I’d like to find how to actually get my script to work, and apply the changes I’ve made to my Forward Dash onto my other dashes.

  1. What is the issue? Include screenshots / videos if possible!
External Media

My current issue is that the code I have for the forward dash doesn’t work (It uses :ApplyImpulse) while everything else (which creates a velocity instead) does. The video quality is absolute trash, so here are the important segments I believe are relevant. These are both in a local script.

Forward Dash

if WKeyDown then
	print(hrp.CFrame.LookVector)
	hrp:ApplyImpulse(hrp.CFrame.LookVector * 110)
elseif...

Other Dashes

elseif AKeyDown then
	local Tween = TweenService:Create(hrp,TweenInfo.new(DashTime,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{Velocity = hrp.CFrame.RightVector * -110})
	Tween:Play()
elseif SKeyDown then...

I’ve confirmed that the other dashes work perfectly fine, but the Forward Dash doesn’t work.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I’ve found a few topic that notes that :ApplyImpulse() doesn’t work when managed by the client. I think this might be my issue, but I’m not sure how to implement it.

More code can be provided if it calls for it, and there’s a free model that I “borrowed inspiration” from in order to write this script.

I read and thought about it for a bit, and I realized I could use a remote event to trigger a regular script located somewhere in ReplicatedStorage. Will try this out once I get the time.

didnt even know this existed till now, heres the api page if you dont alr have it

also great to mention i think the HRP is a meshpart and not a basepart

BasePart is a group of basically all parts, as well as Terrain. That includes MeshParts.

1 Like

Turns out, it wasn’t the server/client thing at all! It was the fact my force was too weak… here’s my new script.

dashRequest.Event:Connect(function()
	script["Plasma Beam"]:Play() -- ignore the sound effect
	if WKeyDown then
		hrp:ApplyImpulse(hrp.CFrame.LookVector * 2000)
	elseif AKeyDown then
		hrp:ApplyImpulse(hrp.CFrame.RightVector * -2000)
	elseif SKeyDown then
		hrp:ApplyImpulse(hrp.CFrame.LookVector * -2000)
	elseif DKeyDown then
		hrp:ApplyImpulse(hrp.CFrame.RightVector * 2000)
	else
		hrp:ApplyImpulse(hrp.CFrame.LookVector * 2000)
	end
end)

I think the reason why :ApplyImpulse works in this scenario is that the hrp is set to client management due to proximity? I’m not too sure, might have to look into it later.

3 Likes

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