I’ve tried BodyVelocity, LinearVelocity, and AssemblyLinearVelocity, all three methods give me the same result.
It just moves the dummy to one single direction
Here are the scripts
Module.Knockback = function(Character, Direction, Duration)
if not Character then return end
local LowerTorso = Character:WaitForChild("LowerTorso")
LowerTorso.AssemblyLinearVelocity = Direction
task.spawn(function()
task.wait(Duration)
LowerTorso.AssemblyLinearVelocity = Vector3.new(0,0,0)
end)
end
local KnockbackStrength = 10
local KnockupStrength = 0
HitModule.Knockback(Hit.Parent, (Root.CFrame + Root.CFrame.LookVector * KnockbackStrength).Position + Vector3.new(0,KnockupStrength,0), 0.4)
I would use a VectorForce object since it allows you to add a force to the Dummy based on its rotation. AssemblyLinearVelocity adds a force to the Dummy based on the world’s rotation, so it will always go in the same direction no matter what since that never changes.
Hi again, i’m sorry but I’m terrible with Velocities and I’m really confused on how to use it. Can you help me out?
this is my current code.
Module.Knockback = function(Character, Target: Model, KnockbackStrength: number, KnockupStrength: number, Duration: number)
if not Character or not Target then return end
local Root = Target:WaitForChild("HumanoidRootPart")
local Direction = Root.CFrame.LookVector
Root.AssemblyLinearVelocity = Direction
task.spawn(function()
task.wait(Duration)
Root.AssemblyLinearVelocity = Vector3.new(0,0,0)
end)
end
Module.Knockback = function(Character, Target : Model, KnockbackStrength: number)
if not Character or not Target then return end
local TargetRoot = Target:WaitForChild("HumanoidRootPart")
local AttackerRoot = Character:WaitForChild("HumanoidRootPart")
local TargetMass = TargetRoot.AssemblyMass
local Direction = AttackerRoot.CFrame.LookVector
TargetRoot:ApplyImpulse((Direction*KnockbackStrength)/TargetMass)
end
Yup, anything I do does not work.
Maybe the issue comes from the line that calls the function?
Hitbox.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Character then
if not table.find(Hits, Hit.Parent) then
AnimationsModule.Play(Hit.Parent:WaitForChild("Humanoid"), 17852123099, 1)
HitModule.Hit(Hit, Hits, Damage, Config:WaitForChild("StunLength").Value, Character, Player)
----> HitModule.Knockback(Hit.Parent, Hitbox.Position, 0.3)
SoundsModule.Play(Root, SFXFolder:WaitForChild("Punches"):WaitForChild("Punch7"):Clone())
local Attachment = VFXFolder:WaitForChild("Hit"):WaitForChild("Core"):Clone()
game:GetService("Debris"):AddItem(Attachment, 0.5)
Attachment.Parent = Hit.Parent:WaitForChild("UpperTorso")
VFXModule.EmitAll(Attachment)
print((Hit.Parent:WaitForChild("HumanoidRootPart").Position).Unit * Vector3.new(0,Config:WaitForChild("KnockupDistance").Value,-Config:WaitForChild("KnockbackDistance").Value))
end
end
end)