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

How do I Disable Jumping?

I am trying to make a world with a lot of forced perspective, and I really need to disable jumping to go along with that! I don't need people jumping my walls. Could someone please give me some help in making a script that disables that. I am trying to learn the basics, but I need to get this done soon as I like having my game in an open beta format, but don't need any noobs receiving backstage access. Thanks, guys!

1 comment

0

Ok, I tried Dreamy's script in every possible location, and nothing worked! Any help on that?

3 answers

✓ Accepted answer

Inset a script then:

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		local humanoid = character:findFirstChild("Humanoid")
		if humanoid then
			humanoid.Changed:connect(function(property)
				if humanoid.Jump == true then
					humanoid.Jump = false
					humanoid.Sit = false
					humanoid.PlatformStand = false
				end
			end)
		end
	end)
	
	local character = player.Character
	
	if character then
		local humanoid = character:findFirstChild("Humanoid")
		if humanoid then
			humanoid.Changed:connect(function(property)
				if humanoid.Jump == true then
					humanoid.Jump = false
					humanoid.Sit = false
					humanoid.PlatformStand = false
				end
			end)
		end
	end
end)

I'm sure a simple

while true do
wait()
if(script.Parent.Parent.Character:FindFirstChild("Humanoid")) then
script.Parent.Parent.Character.Humanoid.Jump = false
end
end

as a script in StarterPack or StarterGui would do.

I've been waiting for an explanation just like you for a very long time. I've found the solution, though.

When the game starts, your character takes a very short time to load. Even the humanoid takes a short time to be added. We can't use FindFirstChild as easily, since that would return false. Instead, use WaitForChild. WaitForChild, as the function's name implies, will wait for the object inside its brackets to some into existence.

Try out this code that I made:

player = game.Players.LocalPlayer

player.CharacterAdded:connect(function(c)
	c:WaitForChild("Humanoid").Changed:connect(function(k)
		c.Humanoid.Jump = false		
	end)
end)

Remember, make a local script and put it into the StarterGui to make it work!

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