Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Making a Pushback effect?

Asked by
yoshiegg6 176
9 years ago

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?

0
Have you tried BodyThrust? woodengop 1134 — 9y
0
BodyThrust will have a similar problem; either the force is too weak or too strong. This is because the amount of friction the character model exerts upon the ground. Redbullusa 1580 — 9y
0
ahh.. woodengop 1134 — 9y
0
Wooohooo random downvote yoshiegg6 176 — 9y
0
Yay another random downvote. yoshiegg6 176 — 9y

2 answers

Log in to vote
2
Answered by
SurVur 86
9 years ago
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.

0
Thanks, this helped me a lot. yoshiegg6 176 — 9y
Ad
Log in to vote
-1
Answered by
lukedm 0
9 years ago

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)

0
Why did you copy & paste SurVur's code? Redbullusa 1580 — 9y
0
Downvoted for copying and not using a code block. yoshiegg6 176 — 9y

Answer this question