Here's the script I have for the data store.
local DataStoreService = game:GetService("DataStoreService")
local MBucksDataStore = DataStoreService:GetDataStore("MBucksDataStore")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "playerstats"
local Cash = Instance.new("IntValue", leaderstats)
Cash.Name = "MBucks"
local data
local userID = player.UserId
local success, errormessage = pcall(function()
data = MBucksDataStore:GetAsync(userID)
end)
if success then
Cash.Value = data
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local userID = player.UserId
local data = player.playerstats.MBucks.Value
local success, errormessage = pcall(function()
MBucksDataStore:SetAsync(userID, data)
end)
if success then
print("Data succesfully saved.")
else
print("There was an error when saving data.")
warn(errormessage)
end
end)
It won't even print the error message or warn the error message. There are no errors in the output, and I did change it in the server. Please help.

4 comments
are you in studio
Yes.
did you enable api services in studio
yes