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

How do I "Push" the target player's body upon hit?

Asked by 5 years ago

I don't really know how to go about scripting a "Push" how should I approach it? This is a snippit of the script, the part where I want the player to be pushed away. I want hum1, the target to be pushed away from the user. Also it is an attempt at rasengan from Naruto Lol.

Please Help... this is killing me

01rasen.Handle.Touched:Connect(function(tag)
02    local hum1 = tag.Parent:FindFirstChild("Humanoid")
03local animtrack2 = hum1:LoadAnimation(anim2)
04            if hum1 ~= nil and db == false then hum1:TakeDamage(45)
05                animtrack2:Play()
06                animtrack1:Play()
07 
08                hum.WalkSpeed = 0
09                hum1.WalkSpeed = 0
10                rasen.Handle.explode.Playing = true
11                hum1.Sit = true
12                db = true
13                local torso = hum1.Parent:FindFirstChild("Torso")
14                local torso1 = char:FindFirstChild("Torso")
0
By "push", do you mean fling them as if hit with a lot of force? LukeSmasher 619 — 5y
0
Yeah RemyKing_XL 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Use a Bodyvelocity

Insert a body velocity inside the enemy's Torso or HumanoidRootPart, and make them fly.

Link for better understanding:

https://developer.roblox.com/en-us/api-reference/class/BodyVelocity

You could use some lines like this ;

1local bv = Instance.new("BodyVelocity")
2bv.Parent = (The enemy's Torso or HumanoidRootPart)
3 
4bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) -- This can be identified as the power
5 
6bv.Velocity = (Your torso/HumanoidRootPart) .CFrame.lookVector *100
Ad

Answer this question