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
 

Re: DataStore StringExpected?

Previous Thread :: Next Thread 
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
02 Feb 2015 08:17 AM
line 21 sting expected (not counting this line) any help?
wait()
local DataStoreService = game:GetService("DataStoreService")
local SafeStore = game.ServerStorage:FindFirstChild("PlayersData")
game.Players.PlayerAdded:connect(
function(Player)
local PlayerStore = DataStoreService:GetDataStore(tostring(Player.userId), "PlayerData")
-----
----Start Of Client Store
local PlayerTag = Instance.new("StringValue",SafeStore)
PlayerTag.Value = Player.userId
PlayerTag.Name = (Player.userId)
print(PlayerTag.Name)
------
local DataStore = Instance.new("Folder",PlayerTag)
DataStore.Name = "Data"
------Player load
local SlotHold = Instance.new("Folder",DataStore)
SlotHold.Name = "SlotHold"
local SlotOne = Instance.new("StringValue",SlotHold)
SlotOne.Name = "Slot1"
SlotOne.Value = PlayerStore:GetAsync("SlotOne")
-----
local SlotTwo = Instance.new("StringValue",SlotHold)
SlotTwo.Name = "Slot2"
SlotTwo.Value = PlayerStore:GetAsync("SlotTwo")
-----
local SlotThree = Instance.new("StringValue",SlotHold)
SlotThree.Name = "Slot3"
SlotThree.Value = PlayerStore:GetAsync("SlotThree")
----
-----Fake Values
repeat wait() until SafeStore:findFirstChild(Player.userId)
local PlayerData = SafeStore:findFirstChild(Player.userId)
repeat wait() until PlayerTag:findFirstChild("Data")
repeat wait() until SlotHold:findFirstChild("Slot1")
repeat wait() until SlotHold:findFirstChild("Slot2")
repeat wait() until SlotHold:findFirstChild("Slot3")
------
local FakeDataStore = Instance.new("Folder",Player)
FakeDataStore.Name = "Data"
------Player load
local FakeSlotHold = Instance.new("Folder",FakeDataStore)
FakeSlotHold.Name = "SlotHold"
local FakeSlotOne = Instance.new("StringValue",FakeSlotHold)
FakeSlotOne.Name = "Slot1"
FakeSlotOne.Value = PlayerStore:GetAsync("SlotOne")
-----
local FakeSlotTwo = Instance.new("StringValue",FakeSlotHold)
FakeSlotTwo.Name = "Slot2"
FakeSlotTwo.Value = PlayerStore:GetAsync("SlotTwo")
-----
local FakeSlotThree = Instance.new("StringValue",FakeSlotHold)
FakeSlotThree.Name = "Slot3"
FakeSlotThree.Value = PlayerStore:GetAsync("SlotThree")
----
repeat wait() until Player:findFirstChild("Data")
repeat wait() until Player.Data:findFirstChild("Slot1")
repeat wait() until Player.Data:findFirstChild("Slot2")
repeat wait() until Player.Data:findFirstChild("Slot3")
end)
-----UpdateAsync
game.Players.PlayerRemoving:connect(function(Player)
local PlayerStore = DataStoreService:GetDataStore(tostring(Player.userId), "PlayerData")
local PlayerDat = SafeStore:findFirstChild(Player.userId)
if SafeStore:findFirstChild(Player.userId) then
PlayerStore:SetAsync("SlotOne", PlayerDat.Data.SlotHold["Slot1"].Value)
PlayerStore:SetAsync("SlotTwo", PlayerDat.Data.SlotHold["Slot2"].Value)
PlayerStore:SetAsync("SlotThree", PlayerDat.Data.SlotHold["Slot3"].Value)
end
end)
----10
game.OnClose = function()
wait(5)
end
Report Abuse
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
02 Feb 2015 08:36 AM
I guess everyone is asleep?
Report Abuse
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
02 Feb 2015 08:57 AM
b1
Report Abuse
Stefan631 is not online. Stefan631
Joined: 23 Dec 2010
Total Posts: 1350
02 Feb 2015 08:58 AM
At the end of line 21 put 'or 0'
Report Abuse
earthyreuben is not online. earthyreuben
Joined: 17 Jan 2010
Total Posts: 669
02 Feb 2015 09:24 AM
Line 21 is expecting a string, it saying that it needs one means that it is not getting a string. Putting the puzzle pieces together we get that:
SlotOne.Value = PlayerStore:GetAsync("SlotOne")

Calls a nil values.

Solution:
When calling a value put a default value next to it. Example:

a = nil

StringValue.Value = a or "Was a nil value"

etc.
Report Abuse
Ruinable is not online. Ruinable
Joined: 14 Sep 2014
Total Posts: 8903
02 Feb 2015 09:26 AM
DataStore can't save instances. Sorry.
Report Abuse
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
02 Feb 2015 10:04 AM
I'm not saving Instances, just the values.
Report Abuse
Ruinable is not online. Ruinable
Joined: 14 Sep 2014
Total Posts: 8903
02 Feb 2015 10:27 AM
I saw instance new and assumed. I hate combing over other people's scripts unless I can see everything that is defined.
Report Abuse
Ruinable is not online. Ruinable
Joined: 14 Sep 2014
Total Posts: 8903
02 Feb 2015 10:28 AM
Can you put the script on codepad.org and paste it as it is so I can see line 21?
Report Abuse
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
02 Feb 2015 01:22 PM
Line 21 ... SlotOne.Value = PlayerStore:GetAsync("SlotOne")
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