ByDefault
|
  |
| Joined: 25 Jul 2014 |
| Total Posts: 3197 |
|
|
| 05 Jan 2016 03:31 AM |
What, why is this line erroring "keys must be strings"?
local inv = inventory[tostring(player.Name)] workspace.ClientToServer:FireServer("SetInventory",inv) |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 05 Jan 2016 04:08 AM |
Post the server's end of that.
|
|
|
| Report Abuse |
|
|
ByDefault
|
  |
| Joined: 25 Jul 2014 |
| Total Posts: 3197 |
|
|
| 05 Jan 2016 05:37 AM |
This is on client: workspace.ClientToServer:FireServer("SetInventory",inventory[player.Name]) -> errors "keys must be strings"
This is on server: if event == "SetInventory" then print(type(eventInfo)) -> table inventory[client.Name] = eventInfo
|
|
|
| Report Abuse |
|
|
|
| 05 Jan 2016 05:44 AM |
| Post the server's connection line |
|
|
| Report Abuse |
|
|
ByDefault
|
  |
| Joined: 25 Jul 2014 |
| Total Posts: 3197 |
|
|
| 05 Jan 2016 05:46 AM |
script.Parent.OnServerEvent:connect(function(client,event,eventInfo) if event == "SetInventory" then print(type(eventInfo)) inventory[client.Name] = eventInfo |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 05 Jan 2016 05:51 AM |
If the local script errored at the sending part and the server still got the data that means the error is coming from the server.
|
|
|
| Report Abuse |
|
|
|
| 05 Jan 2016 05:56 AM |
| could you explain what you are doing |
|
|
| Report Abuse |
|
|
ByDefault
|
  |
| Joined: 25 Jul 2014 |
| Total Posts: 3197 |
|
|
| 05 Jan 2016 06:01 AM |
From the code snippets I've posted, can't you figure it out?
I've made an inventory system and most items get added client sided. So when I try to save it I need the client to set the inventory on the server |
|
|
| Report Abuse |
|
|
ByDefault
|
  |
| Joined: 25 Jul 2014 |
| Total Posts: 3197 |
|
|
| 05 Jan 2016 06:10 AM |
| I've put tostring() inside every key when I try to index a dictionary, yet the error still occurs. |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2016 06:11 AM |
@ByDefault is this for that one guy that said he wanted an inventory made?
anyways your client work makes no sense because its almost as if you're running every players inventory. also you're doing [tostring(player.Name)] which makes absolutely no sense because player.Name already returns a string.
also if you're making an inventory why don't you just make a table with all the items in it, add items on the server once a character obtains an item, and fire the client with the updated items?
create a table guide on the server which relies on strings that relates to ingame objects, and save a player's inventory table when a player gets an object
that would be the smartest way to do this. this way you dont have to worry about things not getting saved, nor any exploits. |
|
|
| Report Abuse |
|
|
Jilixi
|
  |
| Joined: 20 Jan 2009 |
| Total Posts: 1016 |
|
|
| 05 Jan 2016 06:17 AM |
| If this is for me you don't have to continue; Climaximus has it under control; Sorry for any wasted time friend. |
|
|
| Report Abuse |
|
|
ByDefault
|
  |
| Joined: 25 Jul 2014 |
| Total Posts: 3197 |
|
|
| 05 Jan 2016 06:18 AM |
No this is for my own mining game
http://www.roblox.com/games/336457286/Gold-Diggers |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2016 06:32 AM |
| @ByDefault then by all means, take my advice. its the best way to go about the situation. |
|
|
| Report Abuse |
|
|