Making player fling up and away from another player

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make the other player fling up and away from my player for a uppercut ability
  2. What is the issue? Include screenshots / videos if possible!
    I can’t do it. It is very inconsistent
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Tried many rescources
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
							local AttackerHumanoidRootPart = game.Players:FindFirstChild(player).Character.HumanoidRootPart
							local EnemyHumanoidRootPart = hum.Parent.HumanoidRootPart
							local KnockbackSpeed = 350 
							local attackercframe = AttackerHumanoidRootPart.Position * Vector3.new(0,-20,0)
							local Velocity = (AttackerHumanoidRootPart.Position - attackercframe).Unit *KnockbackSpeed

							EnemyHumanoidRootPart.AssemblyLinearVelocity = Velocity

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

heres a modulescript that i use for my knockback. it scales based on mass so the distance is constant

the smoothest way to make knockback is to send a remote event to the client getting knocked back, telling it to knock its own character back

local mod = {}

mod.getMass = function(Model: Model)
	local TotalMass = 0;
	for _,Values in pairs(Model:GetDescendants()) do
		if (Values:IsA("BasePart")) then
			TotalMass += Values.AssemblyMass;
		end
	end
	return TotalMass
end

mod.getImpulseVector = function(Character: Model, EnemyCharacter: Model, Range: number, Height: number)
	
	Height = Height or 0 
	
	local enemyMass = mod.getMass(EnemyCharacter)
	
	local heightVector = Vector3.new(0, enemyMass * Height, 0)
	local characterLookVector = Character.PrimaryPart.CFrame.LookVector
	
	return (characterLookVector * enemyMass * Range) + heightVector

end

return mod

okay, and what If I wanted to knock a npc back, an 2 player roblox test takes a lot of power that my computer doesn’t have

if its an npc then do all the knockback on the server

what methood should I use, we have many methoods to apply velocity on roblox

just use the module i gave you
It uses applyimpulse which is the same thing you were doing with assemblylinearvelocity

its so inconsistent, how can I make it work consistently, sometimes it flings high, sometimes low.

the height does litereally nothing :frowning:

Um, wouldn’t this make the player go down instead of up? Maybe that’s the cause?

Also you may wanna change the humanoidstate type to ragdoll just to make the fling a bit more powerful I guess.

please make an example for what I asked, Im using this for an uppercut. Oh plzplzplzplzplz

But then why is he still going down… That doesn’t add up…

I just want to make an uppercut :"(

just help a guy out and answer the post

Well to be honest I can’t tell if you’re doing it right or wrong. Part of me thinks that alone is not just your code, or if that’s just the main parts.

If you want to uppercut, check the distance between each player is like 2 studs. Then get an uppercut animation I guess, the actual character should move because of motor6ds.

But I may be wrong because I’ve never made one before but I assume that’s how it’d work sort of.

and what is the world in motor6ds?

the velocity should be something like this

lookvector is a unit vector that represents the direction the attacker is looking in
then multiply that by the knockback speed and add height

local KnockbackSpeed = 350 
local height = 300
local Velocity = (AttackerHumanoidRootPart.CFrame.LookVector * KnockbackSpeed) + Vector3.new(0,height,0)

Use .Unit and make a bodyvelocity

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