r/GLua • • Feb 05 '21

Need help for a power script

So, I'm trying to make a fnaf type power script, and i can't find out how to remove the power with a timer. I don't even know if I'm doing the right thing here. Also it doesn't seem to print anything in the script. It seems like the functions aren't working, but i don't know.

local power = 99
local function RemovePower()
    local power=power-1
    print(power)
end
local function StartScript()
    timer.create("PowerRemover", 1, 99, RemovePower)
end

hook.Add( "Initialize", "Timer", StartScript )
2 Upvotes

11 comments sorted by

View all comments

Show parent comment

1

u/the_Nalvor Feb 05 '21

I can't do much else while on my phone. If someone else hasn't spoken up by the time I'm off work I'll get back to you.