Jump to content

How do I do a server DoPeriodicTask?


Recommended Posts

As always I go with my bad knowledge on this so here goes:

I put 

TheWorld:DoPeriodicTask(announcement_cooldown, DoFunction)

(announcement_cooldown and DoFunction are irrelevant right now)

but client_log.txt shows this:

[00:00:46]: [string "../mods/periodic-announcer/modmain.lua"]:34: attempt to index global 'TheWorld' (a nil value)

If I do GLOBAL.TheWorld it says the field value is nil instead so I'm lost, thanks in advance.

Link to comment
Share on other sites

On 7/31/2018 at 9:57 AM, Residays said:

attempt to index global 'TheWorld' (a nil value)

local function hello(inst)
    GLOBAL.print("hey")
end

AddPrefabPostInit("world", function(inst)
    if inst.ismastersim then
        inst:DoPeriodicTask(3, hello)
    end
end)

 

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...