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

I Made this save script and im getting this error help?

Asked by
abrobot 44
6 years ago
01game.Players.PlayerAdded:connect(function(player)
02    local PlayerStorege = player:WaitForChild("PlayerStorege")
03    local RemoteSAVE = PlayerStorege:WaitForChild("RemoteSAVE")
04    local RemoteLOAD = PlayerStorege:WaitForChild("RemoteLOAD")
05    local Cash = player.PlayerStats:WaitForChild("Cash")
06 
07    wait(5)
08    Cash.Value = PlayerCashDataStore:GetAsync(player.UserId) or 0
09    if PlayerCashDataStore:GetAsync(player.UserId) == 0 then
10    Cash.Value = 100
11    PlayerCashDataStore:SetAsync(player.UserId, Cash.Value)
12            else
13    end

ERROR Unable to cast value to function

0
If you posted the full code that would help alot, and the error explains itself User#19524 175 — 6y

1 answer

Log in to vote
0
Answered by
abrobot 44
6 years ago
01local DataStore = game:GetService("DataStoreService")
02local PlayerCashDataStore = DataStore:GetDataStore("PlayerCashDataStoreeee")
03 
04 
05 
06game.Players.PlayerAdded:connect(function(player)
07    local PlayerStorege = player:WaitForChild("PlayerStorege")
08    local RemoteSAVE = PlayerStorege:WaitForChild("RemoteSAVE")
09    local RemoteLOAD = PlayerStorege:WaitForChild("RemoteLOAD")
10    local Cash = player.PlayerStats:WaitForChild("Cash")
11 
12    wait(5)
13    Cash.Value = PlayerCashDataStore:GetAsync(player.UserId) or 0
14    if PlayerCashDataStore:GetAsync(player.UserId) == 0 then
15    Cash.Value = 100
View all 38 lines...
Ad

Answer this question