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

How do I Disable Jumping?

Asked by 10 years ago

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!

0
Ok, I tried Dreamy's script in every possible location, and nothing worked! Any help on that? Samson554 25 — 10y

3 answers

Log in to vote
0
Answered by
dreamy67 135
10 years ago

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)

Ad
Log in to vote
0
Answered by 10 years ago

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.

Log in to vote
0
Answered by 9 years ago

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!

Answer this question