I'm sorry, I'm new to DataStores.
local DataStoreService = game:GetService("DataStoreService") local myDataStore = DataStoreService:GetDataStore("DATA") game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder", player) leaderstats.Name = "leaderstats" local tokens = Instance.new("IntValue", leaderstats) tokens.Name = "Tokens" tokens.Value = 0 local data local success, errormessage pcall(function() data = myDataStore:GetAsync(player.UserId.."-Tokens") end) if success ~= nil then tokens.Value = data else print("There was an error while getting your data.") warn(errormessage) end end) game.Players.PlayerRemoving:Connect(function(player) local success, errormessage = pcall(function() myDataStore:SetAsync(player.UserId.."-Tokens",player.leaderstats.Tokens.Value) end) if success then print("Data succesfully saved.") else print("There was an error when saving data.") warn(errormessage) end end)
I only looked at it for a second but I saw on line 15 you forgot an "=".