Hello, I currently have a baseball bat tool that I want to add knockback to, I have gotten help with this before but the help I did receive wasn’t very helpful for the game I was originally making
people are telling me to use body velocity, I have tried using knockback modules but to no avail. Any suggestions?
Well you could make a body velocity that finds the look vector of the bat and then applies it to the velocity of the body velocity which causes the player to fling back in an unstoppable motion until they hit a wall.
Edit: I have no idea how people keep stumbling on this post BUT DON’T USE THIS. BODY VELOCITY IS NOW DEPRECATED AND SHOULD NOT BE USED ANYMORE.
idk how to explain lol but heres a code you may be able to tweak:
local tool = script.Parent
tool.Activated:Connect(function()
script.Parent.Handle.Touched:Connect(function(hit)
if hit and hit.Parent:IsA("Model") and hit.Parent:FindFirstChild("HumanoidRootPart") then
local KnockBack = Instance.new("BodyVelocity")
KnockBack.Name = "Knockback"
KnockBack.MaxForce = Vector3.new(10000,10000,10000)
KnockBack.Velocity = hit.Parent.HumanoidRootPart.CFrame.LookVector * -100
KnockBack.Parent = hit.Parent.HumanoidRootPart
wait(0.25)
KnockBack.Velocity = Vector3.new(0,0,0)
KnockBack:Destroy()
end
end)
end)