|
| 27 Jan 2015 04:18 PM |
when i start my game the following script errors
http://codepad.org/stzh6Zfe
the error is 14:15:08.338 - WaitForReady is not a valid member of Player 14:15:08.339 - Script 'ServerScriptService.data', Line 5
please help? |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 27 Jan 2015 04:19 PM |
| It's only necessary to call Player:WaitForDataReady() if you are using Data Persistence. You aren't, you're using Data Stores so the call is unecessary. |
|
|
| Report Abuse |
|
|
| |
|
cycoboy83
|
  |
| Joined: 31 May 2011 |
| Total Posts: 831 |
|
|
| 27 Jan 2015 04:19 PM |
| It's WaitForDataReady, not WaitForReady |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Jan 2015 04:24 PM |
it now errors
14:24:44.896 - ServerScriptService.data:23: attempt to index field '?' (a nil value) |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 27 Jan 2015 04:33 PM |
| :WaitForDataReady() is for data persistence not data stores |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2015 04:37 PM |
| WaitForDataReady is for persistence not stores as above said. |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2015 08:59 PM |
well i removed it and got this 14:24:44.896 - ServerScriptService.data:23: attempt to index field '?' (a nil value) |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2015 09:04 PM |
You should learn to debug yourself.
"local stats2 = np:FindFirstChild("leaderstats"):GetChildren() if stats2 then"
Remove the check, since it does nothing for you.
local stats2 = np.leaderstats:GetChildren() for i=0, #stats2 do stats2[i].Value = datastore:GetAsync(stats2[i].Name) end
You shouldn't be getting DataStores that much. I recommend you just save a table to the DataStore instead, so you don't need to repeatedly get data. |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2015 09:05 PM |
| And your problem is, Lua tables are not 0-based. They are 1-based tables. |
|
|
| Report Abuse |
|
|