The knockback that I’ve made goes super crazy when going too close to the enemy. Here’s a video:
Not only is it going crazy, it’s driving me crazy!
I cant seem to find what I’ve done wrong. Here’s the knockback code:
--This is the knockback function
function CombatModule.Knockback(Parent, Velocity, Lifetime)
local Knockback = Instance.new("BodyVelocity")
Knockback.Parent = Parent
Knockback.MaxForce = Vector3.new(math.huge, 0, math.huge)
Knockback.Velocity = Velocity
game.Debris:AddItem(Knockback, Lifetime or 0.1)
end
--
--Here's what I input into the function
--Normal M1
CombatModule.Knockback(EnemyRoot, (HumanoidRootPart.CFrame.LookVector * 15))
--Final M1
CombatModule.Knockback(EnemyRoot, ((HumanoidRootPart.CFrame * CFrame.new(0,3,0)).LookVector * 50), 0.5)
--
I’ve only noticed it now and I’ve done lots of previous testing before. I’m wondering if it’s an update or something and that I need to move to the new bodymovers. Although I’d quite like to stick to BodyVelocity.
I made guis with local scripts that display health and stamina. Also made some other guis that aren’t scripted. I’m thinking of maybe using an alternative (newer) bodymovers but I’m not familiar with any others.
Try Using AssemblyLinearVelocity (IK its not a typo its weird coding grammar). You would do something like Parent.AssemblyLinearVelocity = Velocity*500 (You should play with the numbers you multiply with or it will go berserk)
Sorry mb I meant that its an option he can try to implement, however he will have to figure out how to make it work better. You are right that it is probably inconsistent though.
One other option is using the AlignPosition (I hate it too). It is annoying because you need to make a whole new part and two attachments to get it to work but ig it gets the job done. (roblox why deprecate good bodymovers? ;-; )
I really wish Bodymovers weren’t deprecated because they did work well and were easy to use. (still are but glitchy) I will try these solutions and thanks very much to everyone who has replied.