You can write your topic however you want, but you need to answer these questions:
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
What is the issue? Include screenshots / videos if possible!
I can’t do it. It is very inconsistent
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
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.