Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a touch=lowgravity part?

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

✓ Accepted answer

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)

3 comments

0

thanks ill try :)

0

It worked but can u add a timer? I want 20 seconds when it finish gravity becomes normal

0

Sure, check the editted answer

This discussion is preserved as it was. New answers, comments, and votes are closed.