So I’ve been testing on my combat system for a few months and I’ve been planning on adding knockback to make it more “fluid”. Big problem though: The knockback part of my damage script isn’t working. I’ve looked in youtube, the Developer Hub, even here, but nothing worked.
So I decided to ask for help here on how to fix it:
--Knockback Variables--
local RmtEvent = game.ReplicatedStorage.Punch
local RmtEvent2 = game.ReplicatedStorage.Heavy
local Debris = game:GetService("Debris")
local Force = 80000
local Speed = -40
--The Damage/Knockback/Punch Part--
RmtEvent2.OnServerEvent:Connect(function(Player, Character)
local Humanoid = Character:FindFirstChild("Humanoid")
local HRP = Character:FindFirstChild("HumanoidRootPart")
local BV = Instance.new("BodyVelocity", HRP)
BV.Velocity = Vector3.new(Force, Force, Force) --Doesn't work (problem)
BV.MaxForce = HRP.CFrame.LookVector * Speed -- Also doesn't work (another problem)
Debris:AddItem(BV, 0.35)
end)
So as you can see in the fragment above, when I punch the enemy, the Velocity and MaxForce properties don’t work so the enemy just stands there.
It would be considerate for some answers here!