|
| 22 May 2015 01:21 PM |
PlayerDefault = {Lives = 5} Players = {} Store = game:GetService("DataStoreService"):GetDataStore("1")
game.Players.PlayerAdded:connect(function(Plr) local UserKey = "user_"..Plr.userId print(Store:GetAsync(UserKey)) end)
Workspace.Data:7: attempt to index global 'Store' (a nil value) |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 01:58 PM |
local Data = Store:GetAsync(UserKey) or 1 print(Data)
Try that.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 02:13 PM |
| That's not his problem though. It says "Store" is nil, which he declared at the top. |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 02:14 PM |
But the 7th line is the print() line.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 02:21 PM |
Yes. This has an error: Store:GetAsync(UserKey) because Store is nil.
Indexing means this: Store.SomeValue Store:AnotherValue Store["YetAnotherValue"]
Store is a nil value, and can't be indexed.
If GetAsync was nil, it would say "GetAsync is not a valid member of ______" |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 02:22 PM |
Try renaming the actual DataStore from 1 to something like "One".
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|