local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("myDataStore")
wait(1)
game.Players.PlayerAdded:Connect(function(plr)
local data
local success, errormessage = pcall(function()
data = myDataStore:SetAsync(plr.UserId, game.ReplicatedStorage[plr.Name.."Stats"].Coins.Value)
end)
if success then
print("Data Loaded!")
game.ReplicatedStorage[plr.Name.."Stats"].Coins.Value = data
else
print("Data didn't Loaded Successfully!")
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local success, errormessage = pcall(function()
myDataStore:SetAsync(plr.UserId, game.ReplicatedStorage[plr.Name.."Stats"].Coins.Value)
end)
if success then
print("Data Successfully Saved!")
else
print(errormessage)
print("There was an error while saving game!")
end
end)
What's wrong with this script? Please Help Me.

2 comments
Are your prints working as expected? (i.e. what appears in your console in a live server?)
it prints that it saved and when i join it doesn't prints anything