Jump to content

how can i set cooldown for invoking a function


Recommended Posts

how can i set cooldown for invoking a function 

 

like this,i have a function here

 

local somefuc()

 

local creature = SpawnPrefab("prefab"...

 

doTaskIntime("creature",10)

 

end

 

how can i set the player only can invoke once during 10 sec?

 

is there any time function i can use?

 

 

Link to comment
Share on other sites

 

You can make a use of GetTime() and store the last invoke time as well, so when the player try to invoke, it would perform a check like 

if GetTime() - lastinvoketime < 10 then   returnelse   DoYourStuffsend

thank you a lot ,ill try it out

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...