generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Remote Events - Returning Tables

Previous Thread :: Next Thread 
xSoulSpectrumx is not online. xSoulSpectrumx
Joined: 30 Nov 2011
Total Posts: 2976
19 Jun 2016 09:29 PM
:SERVER:
RemoteService['Manage Inventory'].OnServerEvent:connect(function(client,action,object)
print(client,action,object)
if action == 'Add' then
AssetData:AddItem(client,object)
elseif action == 'Get' then
local Data = AssetData:GetInventory(client)
print('Server Data:',Data)
return Data
end
end)

:SERVER MODULE:
local Inventory = {
--[client] = {}
--[game.Players.Player1] = {['Hat'] = 1} <-- An example of what it contains
}

function lib:GetInventory(client)
print('Inventory Accessed:',client)
print(Inventory[client])
return Inventory[client]
end

-->Inventory Accessed: Player1
-->table: 475883B0
-->Server Data: table: 475883B0


:CLIENT:
local Data = RemoteService['Manage Inventory']:FireServer('Get',false)
print('Inv:',Data)

-->Inv: nil

How can I fix this and pass the table?
Report Abuse
seanbenish is not online. seanbenish
Joined: 31 Jul 2009
Total Posts: 429
19 Jun 2016 09:39 PM
Try switching the remote event to a remote function (and then switch the calls and connectors to :ServerInvoke and .OnServerInvoke)


public static void main(String[] args) { System.out.println("Oops! Wrong language."); }
Report Abuse
xSoulSpectrumx is not online. xSoulSpectrumx
Joined: 30 Nov 2011
Total Posts: 2976
19 Jun 2016 10:02 PM
Thank you that fixed it.
Report Abuse
seanbenish is not online. seanbenish
Joined: 31 Jul 2009
Total Posts: 429
19 Jun 2016 10:03 PM
No problem :)


public static void main(String[] args) { System.out.println("Oops! Wrong language."); }
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image