For some reason my Lua isn't working

Dodobee

Avid Among us enjoyer
Basically, I'm making a prototype for a roguelite-ish system where every time you spawn into a map you get to choose between more speed or more jump height but I don't know why it just doesn't do anything.
Roguelite system prototype:
addHook("PlayerThink", function(player) -- runs once per player each frame
    if player.rogueupgrade == nil then
        player.rogueupgrade = 0
    end
    
    if player.rogueupgradechose == nil then
        player.rogueupgradechose = false
    end
    
    if player.pressedcustom1 == nil then
        player.pressedcustom1 = false
    end
    
    if player.rogueupgradechose == false
    and player.rogueupgrade == 0
    and (player.cmd.buttons & BT_CUSTOM1)
    and player.pressedcustom1 == false then
    player.rogueupgrade = 1
    print("+ Jump")
    player.pressedcustom1 = true
    end
    
    if player.rogueupgradechose == false
    and player.rogueupgrade == 1
    and (player.cmd.buttons & BT_CUSTOM1)
    and player.pressedcustom1 == false then
    player.rogueupgrade = 0
    print("+ Speed")
    player.pressedcustom1 = true
    end
    
    local normalspeed = skins[player.skin].normalspeed
    
    if player.rogueupgradechose == false
    and player.rogueupgrade == 0
    and (player.cmd.buttons & BT_CUSTOM2) then
    player.normalspeed = normalspeed + 5*FRACUNIT
    player.rogueupgradechose = true
    print("Speed increased!")
    end
    
    local normaljump = skins[player.skin].jumpfactor
    
    if player.rogueupgradechose == false
    and player.rogueupgrade == 1
    and (player.cmd.buttons & BT_CUSTOM2) then
    player.jumpfactor = normaljump + 1/4*FRACUNIT
    player.rogueupgradechose = true
    print("Jump height increased!")
    end
    
    if not (player.cmd.buttons & BT_CUSTOM1) then
    player.pressedcustom1 = false
    end
    
    if player.rogueupgradechose == false then
    player.pflags = PF_FULLSTASIS
    end
end)

addHook("PlayerSpawn", function(player)
    player.rogueupgrade = 0
    player.rogueupgradechose = false
end)
 

Who is viewing this thread (Total: 0, Members: 0, Guests: 0)

Back
Top