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

Why is this happening in my data storage currency script? Like the -= in between savedData and nil

Asked by 5 years ago
Edited 5 years ago

``local currencyName = "Coins"

local DataStore = game:GetService("DataStoreService"):GetDataStore("DataStore")

game.Players.PlayerAdded:Connect(function(player)

01local folder = Instance.new("Folder")
02 
03folder.Name = "leaderstats"
04 
05folder.Parent = player
06 
07local currency = Instance.new("IntValue")
08 
09currency.Name = currencyName
10 
11currency.Parent = folder
12 
13 
14local ID = currencyName.."-"..player.UserId
15local savedData = nil
View all 26 lines...

end)

game.Players.PlayerRemoving:Connect(function(player)

1local ID = currencyName.."-"..player.UserId
2 
3DataStore:SetAsync(ID, player.leaderstats[currencyName].Value)

end)

game:BindToClose(function()

1for i, player in pairs(game.Players:GetPlayers())do
2    if player then
3        player:Kick("this game is shutting down")
4    end
5end
6 
7wait(5)

end)

0
nice code blocks greatneil80 2647 — 5y
0
You put ~=, not -=. Tilde equal sign, not hyphen equal sign. Unhumanly 152 — 5y

Answer this question