diff --git a/API.md b/API.md index ca6144a..9053e6a 100644 --- a/API.md +++ b/API.md @@ -187,7 +187,7 @@ Makes a previously hidden HUD bar visible again to a player. It is also possible to read information about existing HUD bars. ### `hb.get_hudbar_state(player, identifier)` -Returns the current state of the active player's HUD bar. +Returns the current state of the active player's HUD bar. Will return `nil` if the hudbar is not initialized. #### Parameters * `player`: `ObjectRef` of the player to which the HUD bar belongs to diff --git a/init.lua b/init.lua index b8b3440..f692e90 100644 --- a/init.lua +++ b/init.lua @@ -446,6 +446,7 @@ end function hb.get_hudbar_state(player, identifier) if not player_exists(player) then return nil end local ref = hb.get_hudtable(identifier).hudstate[player:get_player_name()] + if not ref then return nil end -- Do not forget to update this chunk of code in case the state changes local copy = { hidden = ref.hidden,