Can't get a table inside a module script in a local script?

heres my script:

		local profile = Manager.Profiles[plr]
	
			profile.Data.OrdersDone = profile.Data.OrdersDone + 1
			print(profile.Data.OrdersDone)
			game.ReplicatedStorage.Changedata:FireClient(plr,profile.Data)

it works fine, however, when i do the same in a local script, it says "attempt to index nil with “Data”
is module script not accesible from the local script or something?

Module scripts are accessible from another script as long as it’s in the same environment as the module. So for example, if your module script is on the server, it will only be accessible from a server script. Vice versa. Also, your code snippet it very shorts but you will have to be returning the profile in your ModuleScript’s function. I’m assuming that you are but just making sure

the module script is in replicated storage, this is whats inside the manager:

local module = {}
module.Profiles = {}

return module

(im using profile service)
local script:

local changedata = game.ReplicatedStorage.Changedata

local plr = game.Players.LocalPlayer

local manager = require(game.ReplicatedStorage.Manager)
print(manager.Profiles[plr].Data.OrdersDone)

Profileservice doesn’t work client side. You will have to use @loleris replicaservice module to acheive what you want.

bruh, i guess ill just send a event with the table in it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.