The assignment's left hand expression type `int` cannot be assigned to

Hello guys i wanna make collectibles custom items for my game but ım getting this error whats the reason where am i making mistakes?

CollectAmount needs to be a var

I have a last question, how do i connect two scripts togather
I want to define the same agentdata on the other device
I searched everywhere but couldn’t find anything

@editable TycoonMainDevice : tycoon_main_device = tycoon_main_device{}

Then you link the first creative device with the other and use TycoonMainDevice before anything that references it eg TycoonMainDevice.MyFunction(Agent)

ı referance it but dosent work

I tried several combinations but none worked

Is agent_data instanced anywhere in any device?

yes inside the tycoon_main_device

then you would need to reference that instead, eg if its named TheAgentData : agent_data = agent_data{}

then you’d do set TycoonMainDevice.TheAgentData.Money = 15.0

Still the same
I just want to define the money value in tycoon_main_device to collectibles_device and add a certain amount of money when an item is collected

TheAgentData Does not exist in tycoon_main_device it needs to exist for it to be referenced from a different device

Yes, this worked, but I think I need to go a different way. I don’t know why, but when the item is collected, it does not change the money value.
I think I need to update the UI as well, but I still can’t figure out how to call it in this code.