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

How can I make players pushed back (fling a little)?

Asked by
lilzy7 68
3 years ago
Edited 3 years ago

I saw people using forces to push/fling, so I tried this.

local y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.Velocity = humanoid.Parent.HumanoidRootPart.CFrame.lookVector *  -9000
y.Parent = humanoid.Parent.HumanoidRootPart
game.Debris:AddItem(y,1)

So what i'm doing is putting a body force in humanoid root part, and this only happens if they touch a tornado (spell) for each person. I tried making the value as high/low as I could and nothing happens. So what actually happens is that they take damage from my tornado, but they don't get flinged. How do I make them get pushed back/flinged? I'm confused and please help thx. Note: The humanoid is from the touched function: .Touched:Connect(function(part), part.Parent:FindFirstChild("Humanoid").

2 answers

Log in to vote
1
Answered by
marfit 104
3 years ago

BodyForces are deprecated. I'd recommend using the new movers, which can be found in the same tab as constraints. Only limitation is that they require an Attachment, so using this code should work:

function AddForceToPlayer(Force,Player)
    local Attach = Instance.new("Attachment")
    Attach.Parent = Player.Character.HumanoidRootPart

    local Force = Instance.new("VectorForce")
    Force.Parent = Player.Character.HumanoidRootPart

    Force.Force = Force--a mouthful, but this makes the vectorforce's force equal to the vector3 that you pass as an argument
end
0
wheres the power? lilzy7 68 — 3y
0
btw when the tornado hit the players they just stand still so... lilzy7 68 — 3y
0
You need just one power. Just make the Vector3 you put in as the first argument larger. marfit 104 — 3y
0
oh i put Force instead of a number lol lilzy7 68 — 3y
View all comments (6 more)
0
um... I put a number like 10000 and they dont move... lilzy7 68 — 3y
0
oh wait vector3 lilzy7 68 — 3y
0
they still dont move when i put Vector3.new(10000,10000,10000) on the = Force part lilzy7 68 — 3y
0
My bad. Please add this line: Force.Attachment0 = Attach marfit 104 — 3y
0
OMG THANK YOU SO MUCH IT WORKS!!!! lilzy7 68 — 3y
0
nvm, I just make the humanoids raise a little so the force works. lilzy7 68 — 3y
Ad
Log in to vote
0
Answered by
lilzy7 68
3 years ago
Edited 3 years ago

heres what else I tried but doesn't make the dummies move at all:

main.tornado.Cone.Touched:Connect(function(part)



        local humanoid = part.Parent:FindFirstChild("Humanoid")

        if humanoid then
            if humanoid == player.Character.Humanoid then

            else

                    print("damage worked")
                print((4*multiplier))
                local Attach = Instance.new("Attachment")
                Attach.Parent = humanoid.Parent.HumanoidRootPart

                local Force = Instance.new("VectorForce")
                Force.Parent = humanoid.Parent.HumanoidRootPart

                Force.Force = Vector3.new(100000,100000,100000)
                    humanoid:TakeDamage((4*multiplier))

            end
        end     
    end)

Answer this question