I’m making a spinjitzu script (lol) and I’m trying to add knockback to it. My goal is for them to basically get shot away from the player.
My current script to do this is as follows:
--knockback
if not hit.Parent.Torso:FindFirstChild("spinjitzuVelocity") then
local velocity = Instance.new("BodyVelocity")
velocity.Name = "spinjitzuVelocity"
velocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
velocity.Velocity = (-hit.Parent.HumanoidRootPart.CFrame.LookVector * 50) + Vector3.new(0, 5, 0)
velocity.Parent = hit.Parent.Torso
wait(1)
velocity:Destroy()
end
This occurs when you touch the player’s arm when they’re using spinjitzu.
This works, but not well - they get sent… “flying” (they go up and backwards a decent distance, but very slowly) but it also seems to not take effect until I have moved away from them (for example, if I stand there with spinjitzu, my arm constantly hitting them, nothing happens, but when I finally move away and no longer am hitting them the knockback actually triggers).
How can I fix this? Or is there a better way of achieving this I should use?
EDIT: The script above is an updated script I made after changing it around a little. It’s more consistent, and does what I want, but the problems listed above (the knockback being slow and it not working until I’ve moved away from them) still applies.