Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my datastore script not working on line 9?

Asked by 5 years ago
Edited 5 years ago

On line 9 the (Table[Plr]) part has an error.

SCRIPT:

local DataStore = game:GetService('DataStoreService'):GetDataStore('Data')
local Table = {"Cash"}

game:GetService('Players').PlayerAdded:Connect(function(Plr)
    local DKey = 'Key'.. Plr.UserId
    local Data = DataStore:GetAsync(DKey) or {
    Cash = 0
    },
    Table[Plr]
end)


game:GetService('Players').PlayerRemoving:Connect(function(Plr)
    local DKey = 'Key'.. Plr.UserId
    local Data = Table[Plr]
    DataStore:SetAsync(DKey, Data)
end)
0
What kind of error in the console? Igoralexeymarengobr 365 — 5y
0
Statement spans multiple lines; Use indentation to silence. kittonlover101 201 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

you script has too much information, the computer cannot think so much.

from line 06,

local Data = DataStore:GetAsync(DKey)
if not Data then
    Data = {Cash = 0}
end
Table[Plr] = Data

Ad

Answer this question