badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 14 Sep 2015 12:10 PM |
trying to save data taken from local script using remotefunctions, gives me a keys must be strings error
--inside serverscript function script.RemoteFunction.OnServerInvoke(plrp,saveitem) print("YOO") database[plrp.Name][saveitem] = "" ds:SetAsync(key,hs:JSONEncode(database[plrp.Name]))--where error occurs #2 print(database[plrp.Name]["Bio"]) end
--inside localscript savefunc:InvokeServer(p,"Bio",v3.Text) -- where error occurs #1
Yeah, do as mummy says. Tell that tailor friend of yours to make a nice chicken costume that'll suit your mug. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 14 Sep 2015 12:13 PM |
| well it just means the key isn't a string. Maybe it's a number? Not like there's anyway anyone here could tell based on what's provided. Depending on what "key" is you may be able to just call tostring() on it (if it's a boolean or something obv that wouldn't be a good idea but if it's a userid that's fine). |
|
|
| Report Abuse |
|
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 14 Sep 2015 12:20 PM |
considering this didn't happen when this was all serversided (only difference from then and now is that it's mostly remotefunctions and events) it isn't the variable key that's the problem (i've even tried tostring()ing it)
Yeah, do as mummy says. Tell that tailor friend of yours to make a nice chicken costume that'll suit your mug. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 14 Sep 2015 12:27 PM |
The error is because of the key.
Post the code where key is defined.
Muad'Dib |
|
|
| Report Abuse |
|
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 14 Sep 2015 12:33 PM |
key = player.userId
like i've said before
i've used tostring(), and considering it was working before the remotefunctions & remote event and have literally changed nothing with it since then, that isn't the problem
Yeah, do as mummy says. Tell that tailor friend of yours to make a nice chicken costume that'll suit your mug. |
|
|
| Report Abuse |
|
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 14 Sep 2015 12:49 PM |
b
Yeah, do as mummy says. Tell that tailor friend of yours to make a nice chicken costume that'll suit your mug. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 14 Sep 2015 12:50 PM |
it obviously does matter since it's telling you the key needs to be a string and you're trying to pass a number anyway
idk just concatenate something onto the key, then it must be a string. tostring and concatenate on serverside |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2015 12:51 PM |
Please don't concatenate blank strings just to make things into strings. D:
|
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 14 Sep 2015 12:52 PM |
"Please don't concatenate blank strings just to make things into strings. D:" you must have misunderstood |
|
|
| Report Abuse |
|
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 14 Sep 2015 12:59 PM |
key = "user: "..player.userId
error:keys must be strings
key = tostring(player.userId) error:keys must be strings
Yeah, do as mummy says. Tell that tailor friend of yours to make a nice chicken costume that'll suit your mug. |
|
|
| Report Abuse |
|
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 14 Sep 2015 01:24 PM |
Yeah, do as mummy says. Tell that tailor friend of yours to make a nice chicken costume that'll suit your mug. |
|
|
| Report Abuse |
|
|