You can replace the function with those to use mod-gui
function InitPlayer(player)
mod_gui.get_button_flow(player).add{name="btcharxp", type="sprite-button", sprite = "entity/player", tooltip = {"panel-title"}, style = "mod_gui_button"}
SetupPlayer(player,true)
end
function resetAllPlayerStats()
for _, player in pairs(game.players) do
if not mod_gui.get_button_flow(player).btcharxp then
InitPlayer(player)
else
SetupPlayer(player,false)
end
end
end