This doesn't usually happen, but my leaderstats for my new game isn't showing. Here is the script. I added it to ServerScriptService.
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("MoneyStats")
game.Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder", Player)
Leaderstats.Name = "leaderstats"
local Gold = Instance.new("IntValue", Leaderstats)
Gold.Name = "Gold"
Gold.Value = 0
local Diamonds = Instance.new("IntValue", Leaderstats)
Diamonds.Name = "Diamonds"
Diamonds.Value = 0
local Data = DataStore:GetAsync(Player.UserId)
if Data then
Gold.Value = Data.Gold
Diamonds.Value = Data.Diamonds
end
end)
game.Players.PlayerRemoving:Connect(function(Player)
DataStore:SetAsync(Player.UserId, {
["Gold"] = Player.leaderstats.Gold.Value;
["Diamonds"] = Player.leaderstats.Diamonds.Value;
})
end)

1 comment
I actually copy and pasted your script in a baseplate and it worked fine. I didn't even have API/HTTP enabled. I would try to figure out if it is just occurring in that place for you. If that's the case, another script might be interfering.