Page 1 of 1

Disableing Buttons?

Posted: Sat Oct 02, 2021 12:29 am
by _SleepyWhirl_
i have another quick question, is it possible to disable serten buttons from working in game? such as jumping or running? i was wondering because i am working on sort of a horror thingy at the moment and i want to limit the amount of movement the character should have to make it a bit more thrilling
how would i go about doing this if it is possible?

Re: Disabling Buttons?

Posted: Sat Oct 02, 2021 3:02 am
by Marioman2007
_SleepyWhirl_ wrote:
Sat Oct 02, 2021 12:29 am
i have another quick question, is it possible to disable serten buttons from working in game? such as jumping or running? i was wondering because i am working on sort of a horror thingy at the moment and i want to limit the amount of movement the character should have to make it a bit more thrilling
how would i go about doing this if it is possible?

Code: Select all

function onTick()
    player.keys.down = false
    player.keys.up = false
    player.keys.right = false
    player.keys.left = false
    player.keys.run = false
    player.keys.jump = false
    player.keys.altRun = false
    player.keys.altJump = false
end
remove the lines here as your convenience
OR to disable ALL the keys then simply:

Code: Select all

function onTick()
    for k,v in pairs(player.keys) do
        player.keys[k] = false
    end
end