I've been trying to make a block that pushes players back. I tried bodyforce on the player's torso, but its either too weak to move at all or way too strong, and when the player dies their torso flies away which is messy. How can i just create a brief pushback effect that pushes you a few studs?
db = true script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Torso") then if db then db = false local torso = hit.Parent.Torso torso.Velocity = (torso.CFrame.lookVector) * -100 wait(2) db = true end end end)
Brief Explanation:
I am looking for a torso and then I am setting the Velocity of it. The lookVector
is a unit vector that will point to where the CFrame of the part is facing. Since I want it to push backwards, I multiplied it by -100 to move it backwards. You many change the -100 to a higher or lower number.
db = true script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Torso") then if db then db = false local torso = hit.Parent.Torso torso.Velocity = (torso.CFrame.lookVector) * -100 wait(2) db = true end end end)