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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: keys must be strings error

Previous Thread :: Next Thread 
badfitz67 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
14 Sep 2015 12:51 PM
Please don't concatenate blank strings just to make things into strings. D:
Report Abuse
lordrambo is not online. 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 is not online. 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 is not online. 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
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