So, for a brief backround... I tried making a DataStore that would save my total deaths. But it does not work?
local DataStoreService = game:GetService("DataStoreService") local myDataStore = DataStoreService:GetDataStore("myDataStore") game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder", player) leaderstats.Name = "leaderstats" local Deaths = Instance.new("IntValue", leaderstats) Deaths.Name = "Deaths" player.CharacterAdded:Connect(function(char) Deaths.Value = Deaths.Value + 1 if Deaths.Value == 500 then print("You leveled up!") end local PlayerUserId = "Player_"..player.UserId -- Load Data local Data local sucess, errormessage = pcall(function() Data = myDataStore:GetAsync(PlayerUserId) end) if sucess then -- Setting our data equal to the current cash Deaths.Value = Data end end) game.Players.PlayerRemoving:Connect(function(player) local PlayerUserId = "Player_"..player.UserId -- Setting the data local data = player.leaderstats.Deaths.Value local sucess, errormessage = pcall(function() myDataStore:SetAsync(PlayerUserId, data) end) if sucess then print("Data succesfully saved") else print("Error occured whilst saving leaderstats...") warn(errormessage) end end) end)
And yes i have enabled API services
If you're attempting to know if the DataStore is saving or loading the player's data in Roblox Studio, then it wouldn't save it. It would just load the player's data.
DataStoreService doesn't fully function on Roblox Studio so I suggest you try it on a normal server, not in Roblox Studio.
By the way, I know this isn't related to you're problem but you should be concerned about DataStore limits. If the game exceeds the DataStore limit then the Roblox engine will automatically throttle the game's data store usage, causing data requests to take longer.