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
 

can i not save a string in data store?

Previous Thread :: Next Thread 
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
31 Oct 2016 10:48 PM
Output: Workspace.DataStorage:106: bad argument #3 to 'Value' (string expected, got nil)

local DataStore = ga######################################################################
game.Players.PlayerAdded:connect(function(player)
local key = "user_" .. player.userId
local savedstats = DataStore:GetAsync(key)

local PlayerLevel = Instance.new("IntValue", player)
PlayerLevel.Name = "PlayerLevel"
PlayerLevel.Value = 1

local PlayerName = Instance.new("StringValue", player)
PlayerName.Name = "PlayerName"
PlayerName.Value = "NoName"

local NewPlayer = Instance.new("BoolValue", player)
NewPlayer.Name = "NewPlayer"
NewPlayer.Value = true

local StrengthStat = Instance.new("IntValue", player)
StrengthStat.Name = "StrengthStat"
StrengthStat.Value = 0

local AgilityStat = Instance.new("IntValue", player)
AgilityStat.Name = "AgilityStat"
AgilityStat.Value = 0

local KiStat = Instance.new("IntValue", player)
KiStat.Name = "KiStat"
KiStat.Value = 0

local ExpLevel = Instance.new("IntValue", player)
ExpLevel.Name = "ExpLevel"
ExpLevel.Value = 0

local MaxExpLevel = Instance.new("IntValue", player)
MaxExpLevel.Name = "MaxExpLevel"
MaxExpLevel.Value = 100

if savedstats then
PlayerLevel.Value = savedstats[1]
PlayerName.Value = savedstats[2] -- Getting Error Here.
NewPlayer.Value = savedstats[3]
StrengthStat.Value = savedstats[4]
AgilityStat.Value = savedstats[5]
KiStat.Value = savedstats[6]
ExpLevel.Value = savedstats[7]
MaxExpLevel.Value = savedstats[8]
else
local statstosave = {PlayerLevel.Value, PlayerName.Value, NewPlayer.Value, StrengthStat.Value, AgilityStat.Value, KiStat.Value, ExpLevel.Value, MaxExpLevel.Value}
DataStore:SetAsync(key, statstosave)
end
end)


game.Players.PlayerRemoving:connect(function(player)
local key = "user_" .. player.userId
local savedstats = DataStore:GetAsync(key)
local statstosave = {player.PlayerLevel.Value, player.PlayerName.Value, player.NewPlayer.Value, player.StrengthStat.Value, player.AgilityStat.Value, player.KiStat.Value, player.ExpLevel.Value, player.MaxExpLevel.Value}
end)
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
31 Oct 2016 10:53 PM
i cant read this code help



Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
31 Oct 2016 11:00 PM
nevermind fixed it
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