From 65e254ec454446c8232781324399f48328cc55aa Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Sun, 11 Feb 2024 20:22:51 +0000 Subject: [PATCH] Add spectate check to stop_follow (#285) --- modules/control/spectate.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/control/spectate.lua b/modules/control/spectate.lua index bdafa03e..915b14cb 100644 --- a/modules/control/spectate.lua +++ b/modules/control/spectate.lua @@ -85,7 +85,9 @@ end -- @tparam LuaPlayer player The player that will regain control of their camera function Public.stop_follow(player) assert(player and player.valid, 'Invalid player given to follower') - if following[player.index] and following[player.index][4] then Public.stop_spectate(player) end + if following[player.index] and following[player.index][4] and Public.is_spectating(player) then + Public.stop_spectate(player) + end Gui.destroy_if_valid(player.gui.screen[follow_label.name]) following[player.index] = nil