I just get in to AeroGameFramework, and function didnt work for me

I cant reference the function from the Services to the Controller, it say attempt to index nil with DS2Placement

--Controller
self.Services.TycoonPlacement:DS2Placement()
--Service
function TycoonPlacement.Client:DS2Placement(player)
	local tycoonObjects = DataStore2("TycoonObjects",player)
	return tycoonObjects:GetTable({})
end

That error means that TycoonPlacement is not a attribute of self.Services - it is hard to solve your issue without any more code from the controller.

Also, as its not your own work (I assume) its hard for me to provide a solution if you don’t understand the system yourself (and I have no knowledge on AeroGameFramework) - could you show me the code for the framework else you’ll have to try and get support from its creator (unless someone can provide a solution themselves as they’ve got experience).

I don’t think I know what happened behind the scene also

Have you made any edits to the framework yourself which may have caused it to break?

It would be nice if you could provide me more code so I can help solve it with you - else I cannot do much :slightly_smiling_face:

1 Like

Where is

--Controller
self.Services.TycoonPlacement:DS2Placement()

Placed? It has to be in a function that is a part of the Controller’s table or else Aero Framework can’t give you access to the services table eg:

local MyController = {}

function MyController:Start()
--This should work
    self.Services.TycoonPlacement:DS2Placement()
end
--This would error!
self.Services.TycoonPlacement:DS2Placement()

function CallFunc()
--This will still error when called because CallFunc is not a part of MyController
    self.Services.TycoonPlacement:DS2Placement()
end

return MyController

It placed in the controllers:Start()

I created a working example, let me know if anything is different here.
MyService:

local MyService = {Client = {}}

function MyService:Start()
	
end

function MyService:Init()
	

end

function MyService.Client:Test()
	print("Called from Client!")
end


return MyService

MyController:

local MyController = {}

function MyController:Start()
	self.Services.MyService:Test()
end


function MyController:Init()
	
end

return MyController