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

game.Players.PlayerRemoving -> not firing. Due to Filtering?

Asked by 9 years ago
game.Players.PlayerRemoving:connect(function(player)
    coroutine.resume(coroutine.create(function()
        local plrKills = ods:GetAsync(tostring(player.userId).."Kills")
        local plrXp = ods:GetAsync(tostring(player.userId).."XP")
        if not plrKills then plrKills = 0 end
        if not plrXp then plrXp = 0 end
        for i = 1,#currentData do
            if currentData[i][1] == player.Name then
                ods:SetAsync(tostring(player.userId).."Kills",plrKills + currentData[i][3])
                ods:SetAsync(tostring(player.userId).."XP",plrKills + currentData[i][2])
            end
        end
    end))
end)

This isn't firing when the player leaves. Could this be due to filtering enabled? If so, how do I fix?

0
Is it a local or regular script? Also, the key for a datastore cannot be the userId alone, so try doing something like: "user_"..player.userId instead of tostring(player.userId). EzraNehemiah_TF2 3552 — 9y
0
It's in a regular script. And it's player.userId.."KILLS" ObscureEntity 294 — 9y

Answer this question