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

How do you disable jumping?

I know that it can be done, but I am not sure how. I tried using BodyForce, but that doesn't work. Any suggestions?

4 answers

✓ Accepted answer

Remember that the Jump property of Humanoid is what tells the character to jump, it does not signify that the character is currently jumping. This means that once the Jump property is set to true, the character will jump.

Despite this, the following code will still work because it sets jump to false so fast after it's set to true, Roblox doesn't even notice it. However, It only works in a local script.

local plr = game.Players.LocalPlayer
	repeat wait() until plr.Character
local chr = plr.Character

chr:WaitForChild("Humanoid").Changed:connect(function()
	chr.Humanoid.Jump = false
end)

5 comments

0

Perfect! Thanks a lot!

0

I just realized that using this, you can rebind the space key really easily by just adding code! :D

0

Rebind? The space key will always remain functional, this just deletes the message it sends before Roblox can read it.

0

I mean you can make the space key do other things. However this doesn't work in servers, which is a problem...

0

You can make the space key do other things, just use KeyDown or KeyUp events.

In the player's humanoid there's a Property called "JumpPower." Set it to 0 via Script and that's it!

Copy this as a Script in ServerScriptService, Workspace, Etc:

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		character:WaitForChild("Humanoid").JumpPower = 0
	end)
end)

Just setting Jump to false as soon as it's changed to true does NOT work in server scenarios. They only work in the Play Solo, so this means you need to do some networking or something (with RemoteEvents, etc.) to get it to work properly.

3 comments

0

huh, your right.

0

Or use a local script

0

Using a local script will not work in a server if you want it to be secure from hackers. Meaning, "FilteringEnabled" being set to true.

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