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

Gravity script not working? [SOLVED]

Asked by 9 years ago

So im making something and the script says no errors but wont work is there something wrong with this script ?

script.Parent.Touched:connect(function(hit)

if hit.Parent:FindFirstChild("Humanoid") then

    local bodyForce = Instance.new("BodyForce", hit.Parent.Torso)
    bodyForce.force = Vector3.new(0,300,0)
end

end)

0
Try using more force. Sometimes ROBLOX needs a lot of force to do things. DigitalVeer 1473 — 9y
0
The actual force you want to apply is the (mass of the body) * 9.81 * 20 Quenty 226 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

So there wasn't a problem with the script, just raise the gravity. But you had an issue where it kept cloning it in the player. So here it is.

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirtChild("Humanoid") then
        if hit.Parent.Torso:FindFirstChild("BodyForce") then--If already one in torso
            --Nothing
        else
            local bodyForce = Instance.new("BodyForce", hit.Parent.Torso)
            bodyForce.force = Vector3.new(0,300,0)          
        end
    end
end)
0
Thanks kilohitman 0 — 9y
0
On line 2 you spelled something wrong! if hit.Parent:FindFirstChild("Humanoid") then ***** kilohitman 0 — 9y
Ad

Answer this question