Should I use IsActive check in async functions when there is possibility player could leave and it’s used later with few devices,
Teleporter.Teleport(Player), ClassSelector.ChangeTeam(Player) etc…
Should I use IsActive check in async functions when there is possibility player could leave and it’s used later with few devices,
Teleporter.Teleport(Player), ClassSelector.ChangeTeam(Player) etc…
You don’t need to, since those devices shouldn’t crash upon passed an unvalid player, but it might help increase performance and memory if you use it to abort a running loop that’s not needed if the player left for example
Oh yea I always run player loops + OnPlayerLeftEvent with race so they end when player leaves.
I was just wondering if anything could go wrong if I use invalid player with devices or if I call Hide(), SetHealth()… on invalid FortCharacter.
I also never experienced any problem so it should be fine. Thanks for input.
You should generally be fine @Dr.Joske HOWEVER THERE IS ONE MAJOR EXCEPTION, Verse persistence data if you try to edit/affect the weak_map in any way of a player who has left, it will crash verse completely
Yep, I always have IsActive check when accesing or updating persistent data.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.