Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to fix this bug with body velocity when a player gets hit on my game?

https://youtu.be/tHbF7XC_NBg

Here's the link on what the bug looks like

i tried fixing it,but it made things worse so i need HELP!

6 comments

0

pls provide code / demo place.

0

You can see the code in the video

0

I don't want to decipher and retype code from an image. Post the code in plain text

0

Im just going to make it into a model I'll send a link

0

Here's a demo place https://www.roblox.com/games/4695574001/Joe-Demo-Place-BUGS im not going to make a model anymore

0

Thats not code

1 answer

I don't recommend using LookVector as it's values are relatively low, I instead would use;

local delta = player.Character.HumanoidRootPart.Position - Hit.Parent.HumanoidRootPart.Position
local bv = Instance.new("BodyVelocity")
bv.Parent = Hit.Parent.HumanoidRootPart --You can use any body part here, I just prefer rootpart
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bv.Velocity = delta.magnitude* knockback_strength_here --put your desired knockback here
game.Debris:AddItem(bv, 0.05) --Debris removes instances after x amount of time

Hope it helps!

1 comment

0

Oh well the bug is still here but i learned something new from this :)

This discussion is preserved as it was. New answers, comments, and votes are closed.