Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Module script Pcall stops abruptly?

Asked by 3 years ago
Edited 3 years ago

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.

0
If you print something after SetAsync, does it show up in the output? brokenVectors 525 — 3y

Answer this question