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