This is counter made by function, it works just like standart MC counter but in lua.
Why function? Because you just add function before onTick and can call it like this Co=counter(C1,u,d,r,1,100,-100,0).
You need to add a memory local C1={Cur=0,S=false} each time you call a new counter() just like
local C2={Cur=0,S=false}
local C3={Cur=0,S=false}