ApplyImpulse doesn't work

So I am trying to make a bounce pad but the ApplyImpulse function doesn’t even push the player up

image

2 Likes

try putting the impulse in hit.Parent:FindFirstChild(‘HumanoidRootPart’)

it is probably because you use getmass(). If you use GetMass(), you only get the mass of the hitpart, probably your feet. The player charachter consists of multiple parts. You should do hit.AssemblyMass instead of hit:GetMass(). And probablye do what Creeperman said.

error

it is AssemblyMass. not AssmeblyMass. Make sure to spell it correctly

Ok I just realized I misspelled AssemblyMass but now there isn’t any error but the bounce pad doenst work

Fixed it but now the script doesnt work and theres no error

You can’t :ApplyImpulse a part owned by a player (The character in this case,) from the server. I’ve tried it before.

What you can do is

game.ReplicatedStorage.RemoteEvents.OnApplyImpulse:FireClient(player, part, impulseVector)

Plus you need to set the humanoid state to Freefall before :ApplyImpulse() bcs humanoid behavior is wierd

5 Likes

So I have to use a localscript?

Yes, use local script to apply impulse parts owned by a client from server

i cahgned the script to a localscript and it still didnt work

Show me your code, let me test

V ah yes reply below

Make sure your local script is inside a player’s character
Or
Inside StarterPlayerScripts
Or
Inside ScreenGui

Local scripts must be inside a local being. Try placing it inside of StarterCharacterScripts and making it detect when the humanoid touches the part.


local AdditionalForce = 2500

script.Parent.Touched:Connect(function(hit)
	
	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("HumanoidRootPart") and db == false then
		
		db = true
		
		hit.Parent:FindFirstChild("HumanoidRootPart"):ApplyImpulse(Vector3.new(0, hit.Parent:FindFirstChild("HumanoidRootPart").AssemblyMass * AdditionalForce, 0))
		
		wait(0.5)
		
		db = false
		
	end
	
end)

it works! but the question is, is it only for client side since its a localscript

Okay. Ive said this before, local scripts must be inside a LOCAL BEING. Try placing it in StarterCharacterScripts and use humanoid to detect when you touch the bounce part.

Use remote events if you wish to make it server sidded. Just run a remote when they touch it.

Yes, it will still replicate to server because the part’s physics is controlled by the client

That’s how roblox’s physics work;
any part controlled by the client will be replicated to server (this is to reduce server load calculating physics)


:ApplyImpulse() from client, replicated to server automatically

1 Like

so i have to use FireServer() in a localscript and put the ApplyImpulse in the server script?

Um, no

look at the previous reply

There’s an anti-fall bounce pad below in the image but it’s out of the picture

I used :FireClient() and let the character :ApplyImpulse() to itself from the client

also didn’t you already got it working? .-.