So theres a script I have and it creates leaderstats and saves them. Pretty simple, but only the level is being added to the player, not the coins. pls help? EDIT: I should be a bit more specific. The intvalue isn't appearing inside the player which i need it to.
-- leaderstats
local players = game:GetService("Players")
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("LevelValueSaver")
local ds2 = datastore:GetDataStore("CoinValueSaver")
players.PlayerAdded:connect(function(player)
local folder = Instance.new("Folder")
folder.Name = "leaderstats"
folder.Parent = player
local currency1 = Instance.new("IntValue")
currency1.Name = "Level"
currency1.Parent = folder
currency1.Value = ds1:GetAsync(player.UserId) or 1
ds1:SetAsync(player.UserId, currency1.Value)
local currency2 = Instance.new("IntValue")
currency2.Name = "Coins"
currency2.Parent = folder
currency2.Value = ds2:GetAsync(player.UserId) or 0
ds2:SetAsync(player.UserId, currency2.Value)
currency1.Changed:connect(function()
ds1:SetAsync(player.UserId, currency1.Value)
end)
currency2.Changed:connect(function()
ds2:SetAsync(player.UserId, currency2.Value)
end)
end)

2 comments
You have no even for when a coin is collected, so you need to create one before adding value.
??