Greetings! Im currently working on a knockback module script and its not going so hot, Inputs need to include the Player thats being knocked back, direction they needa get knocked back in, Distance / Power they get knocked back, And height they get knocked back
Ive tried pulling loads of knockback scripts online and modifing them to my needs but its not been working
By online do you mean in the forums here? I’ve seen quite a few posts about knockback or pushback or punching scripts.
Try using different terms that other people might use in their posts when you search and you’ll probably get better results.
local Knockback = {}
function Knockback.Apply(character, dir, force, duration)
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.Parent = -- character humanoid rootpart
-- add velocity based on direction and force
-- remove knockback effect after duration
game:GetService("Debris"):AddItem(bodyVelocity, duration)
end
return Knockback
I remember seeing AppyImpulse is best for this because it is just like a pushing force, not an extended force that needs to be turned off again like BodyVelocity as @Xuadzilla suggested.
I tried searching “knockback applyimpulse” and found this tutorial about using the new character controllers.