My code is a session storing module script which stores data such as in-game money. I can edit these values through the module scripts from other scripts etc
My code for saving data is triggered by when the player is leaving the game.
game.Players.PlayerRemoving:Connect(function(Player)
print("Player removing")
local Key = Player.UserId
print(tostring(Key))
local Success, Error = pcall(function()
PlayerData:SetAsync(Key, SessionStats[Key])
end)
print("pcall done")
if Success then
print("Saved")
else
warn(Error)
end
end)
My code works up until the point when the pcall ends, and "pcall done" never prints or outputs.
I can see nothing immediately wrong with what I've done but any help is appreciated.

1 comment
If you print something after SetAsync, does it show up in the output?