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

How to make a touch=lowgravity part?

Asked by 3 years ago

Pls help me i want if a player touches a part then player falls slowly, and if player stop touching part then gravity become normal. I tried lots of times but i haven't do it Pls help :c

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

So I know this is a long and not the best way, but

IF IT'S LOCAL/ONLY FOR THE PLAYER THAT HIT IT:

Put a LocalScript into StarterGui then put this in the script:

game.Workspace.YourPartNameHere.Touched:Connect(function(hit)
    if hit.Parent.Name == script.Parent.Name then --This will see if the parent of hit (the object that hit it) is the LocalPlayer.
        game.Workspace.Gravity = 000 -- This will set the gravity to something else, replace 000 with anything that's below 196.2, or it will not affect it or add more gravity.
    end
end) -- Ends function, yes we know.

IF IT'S ANYONE THAT HIT IT:

Put a script in the low gravity part and add this in it:

script.Parent.Touched:Connect(function(h) --h is like hit
    if h.Parent:FindFirstChild("Humanoid") then --Checks if it's a player by checking if the object that hit it has a Humanoid
        game.Workspace.Gravity = 000 --This will set the gravity to something else, replace 000 with anything that's below 196.2, or it will not affect it or add more gravity.
    end
end)

With the timer:

game.Workspace.YourPartNameHere.Touched:Connect(function(hit)
    if hit.Parent.Name == script.Parent.Name then --This will see if the parent of hit (the object that hit it) is the LocalPlayer.
        game.Workspace.Gravity = 000
        wait(20)
        game.Workspace.Gravity 196.2 --Normal gravity
    end
end)

(that was for the LocalScript, if you want global, use the 2nd code and add the line 4 and 5 to it)

0
thanks ill try :) Gokdeniz_ProTurk -21 — 3y
0
It worked but can u add a timer? I want 20 seconds when it finish gravity becomes normal Gokdeniz_ProTurk -21 — 3y
0
Sure, check the editted answer LUCATIVIOMAD 31 — 3y
Ad

Answer this question