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

Hello gentlemen.

After the update all my scripts that has the following line in the beginning of the script:

suddenly return this error:

[ERROR] gamemodes/terrortown/entities/weapons/weapon_ttt_sg552/shared.lua:1: attempt to index global ‘resource’ (a nil value)

  1. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_sg552/shared.lua:1

I know I can just use the Resourses.lua file and add them there, but I was just curious why the resource.AddFile command is suddenly returning errors.

Any ideas?

You’re running it clientside.

so just

if SERVER then


I don’t see why you would want resource.AddFile in a shared file anyway, but yeah that’d work.

Yeah, I think I’ll move them to resources.lua instead. Thanks for your help :slight_smile: