How to control throw a player

hello everyone,

i was attempting to make a combat system and was wondering how i would knock a player back, while into the air, before coming back down. i tried using linear velocity, but it’s terrible at getting it off the ground. i’m using it in relitive to A0 and LineVelocity btw.

i dont want to use any deprecated methods, either. i know bodyvelocity would work here, but i dont want to use it for that preference.

whats the best way to do this?
please give a small code sample to show me how this would be used, im new.

3 Likes

I’m assuming you mean that the player stays in the air until the attacked player falls back down- correct me if I’m wrong.

Anyways,

  1. Use LinearVelocity and the Attacked player’s negative LookVector to send them flying backwards after you have hit them (I’m assuming you have hit-detection already scripted)

  2. Just anchor your player’s HumanoidRootPart for a couple of seconds, and then unanchor it.

Sorry that this was rushed, but my brain is fried after coding for, like, 5 hours.

1 Like

no i mean throw them back in an arc like tsb’s uppercut or pinpoint cut

1 Like

try using :ApplyImpulse()
strong text

2 Likes

i tried that but i have no idea how to use it could you give an example

1 Like

so it works like this:

local targetPosition = Vector3.new(50, 5, 20)
local force = targetPosition * Part.AssemblyMass

Part:ApplyImpulse(force)

so basically :ApplyImpulse() makes a force on the part which will take him to that Position in one second and we multiply it by the Mass because of some Boring physics things

1 Like

but how does that put it in an arc to its position? wouldent it just move it directly there?

1 Like

you should also add a Y coordinate to the force :man_shrugging:

1 Like

i have no idea what you mean lol
wont the player immideatly stop moving when it hits the position???

1 Like

so this video here explains very very good

1 Like

no it will slowdown but it will not stop

1 Like

alright, as long as this will work with a player, thanks!

your welcome, you would make me happy if you mark as solution, have a nice day :wave:

You should use things like AssemblyLinearVelocity and/or LinearVelocity for this.

1 Like


buddy
i tried that
it doesnt get the player off the ground

so what you mean by arc throw?

no that will only work in linear Forces

Velocity would probably give you the best control over the throw, I think the reason it doesn’t end up lifting the character off the ground is because the character has multiple parts, you should try adding every part’s velocity in the character and gravity should give you that arc you want.

function ThrowPlayer(Character,ThrowValue)
	for i,v in Character:GetDescendants() do
		if v:IsA("BasePart") then
			v.AssemblyLinearVelocity += ThrowValue
		end
	end
end

why not directly the HumanoidRootPart :sob:

1 Like

Applying it on every part of the character guarantees the same amount of velocity change on every part of the character every time. You could definitely apply it only on the humanoid root part but the throw now matters on how many parts there are in the character.