Timer Help

Im trying to make a payday so I put this code in "init.lua’



function payall()
    for k,v in pairs( player.GetAll() ) do 
        local amount = 0
        if !v:CanAfford(20000) then
            amount = amount + math.random(10,25)
        end
        if !v:CanAfford(10000) then
            amount = amount + math.random(30,45)
        end
        if !v:CanAfford(5000) then
            amount = amount + math.random(20,35)
        end
        if !v:CanAfford(500) then
            amount = amount + math.random(150,200)
        end
        Notify(ply, 0, 3,"Payday you made "..amount.."dollars!" );
    end
end

timer.Create('Payday', 30 ,0, payall())


So why don’t I ever receive money?

From the looks of your code you’re never actually paying them, you’re only changing the variable amount to something else.

Yaa I noticed that but Im never seeing the Payday notice at all

[lua]timer.Create( “Payday”, 30, 0, payall )[/lua]

The timer’s Unique ID, I think, needs to be in double quotes, not single. Also You don’t need the () after the fourth argument.

Yeah his syntax for the timer isn’t correct. Change it to how josh has it and then give it a go.

‘’ and “” are both forms of string. It’ll work fine.

Ahh ok, I know some languages take ‘’ as one character, and “” as a string I just wasn’t sure if Lua could do both, my mistake.