|
| 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 |
|
|
|
| 02 Feb 2015 08:36 AM |
| I guess everyone is asleep? |
|
|
| Report Abuse |
|
|
| |
|
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 |
|
|
|
| 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
|
  |
| Joined: 14 Sep 2014 |
| Total Posts: 8903 |
|
|
| 02 Feb 2015 09:26 AM |
| DataStore can't save instances. Sorry. |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2015 10:04 AM |
| I'm not saving Instances, just the values. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 02 Feb 2015 01:22 PM |
| Line 21 ... SlotOne.Value = PlayerStore:GetAsync("SlotOne") |
|
|
| Report Abuse |
|
|