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

jump script every 5 seconds? (R15)

Asked by 6 years ago
Edited by OldPalHappy 6 years ago

--THIS LOOPS THE JUMP HOW DO I MAKE IT JUMP ONCE EVERY 5 SECONDS?

AFK_ON.MouseButton1Down:connect(function() 
    AFK_OFF.Visible = false
    AFK_ON.Visible = true
    while true do
        wait(5)
        local plr = game.Players.LocalPlayer
        local chr = plr.Character
        chr:WaitForChild("Humanoid"):connect(function()
        chr.Humanoid.Jump = true
        end)
    end
end)

--I TRIED THIS ALSO AND IT DOESN'T WORK

AFK_ON.MouseButton1Down:connect(function() 
    AFK_OFF.Visible = false
    AFK_ON.Visible = true
    while true do
        wait(5)
game.Players.LocalPlayer.Humanoid.Jump = true
    end
end)
0
Is this a server script or local script? awfulszn 394 — 6y
0
Try using things like jump = false whenever the character jumps and wait (5) until jump = true again 222ono222 47 — 6y
0
Turn off your caps lock, Jesus. Tomstah 401 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

So, I'm assuming this is a local script...

So, here is the code, hopefully fixed:

["AFK_ON"].MouseButton1Down:connect(function()
    ["AFK_ON"].Visible = false
    ["AFK_ON"].Visible = true   
    while wait(5) do --set that number to the amount of seconds to wait
    game.Players.LocalPlayer.Character.Humanoid.Jump = true
    end
end)

Your problem was that you were addressing the player, not the character.

game.Players.LocalPlayer.Humanoid.Jump = true

To address the character, you need to do this:

game.Players.LocalPlayer.Character.Humanoid.Jump = true

Notice the "Character" after the "LocalPlayer"

If this helped, please accept the answer. Thanks!

0
thank you so much! my script finally works! AustinBoBoston12 0 — 6y
0
Please accept the answer. It will give us both reputation, and shows that my answer solved your question. MakeYourEscape 334 — 6y
Ad

Answer this question