Hello I made a punching script that is supposed to give a tiny bit of force to any player that you punch. However I am having this issue where sometimes when I hit the player, the player will move upward instead of outward.
My script looks like this:
local victim = game.Workspace.Dummy
local force = math.random(25,35)
local forceDirection = game.Workspace.billybobtijoseph.RightHand
local BV = Instance.new("BodyVelocity",victim.HumanoidRootPart) -- BodyVelocity object
BV.MaxForce = Vector3.new(10000000,10000000,10000000)
--BV.Velocity = CFrame.Angles(0,0,0) * forceDirection.CFrame.LookVector * force --ANGLE = 1, SPEED = 2.
BV.Velocity = forceDirection.CFrame.LookVector * force --ANGLE = 1, SPEED = 2.
local debrisTime = {0.08, 0.1, 0.12, 0.14}
debrisService:AddItem(BV,debrisTime[math.random(1,#debrisTime)]) -- Destroy the BodyVelocity after the character is flung back
Obviously there is more to this script but this is the basic part that is giving me issues.
I think this has something to do with the way my ‘RightHand’ is facing during the animation. However I can’t change the animation. Is there a different way that I can attack this problem and prevent the player from constantly moving upward but instead move outward?? I don’t want to use
local forceDirection = game.Workspace.billybobtijoseph.HumanoidRootPart
because I want the player to move in the direction based on where the punch is going. None of my punches go upward so I am curious to how I can fix this.
You can test this here:
https://www.roblox.com/games/7942689948/Punch-test