From 6c21bae69289df3cfdf1bf0837c68b61c138c38d Mon Sep 17 00:00:00 2001 From: Aqwam Harish Aiman <67371914+AqwamCreates@users.noreply.github.com> Date: Sat, 14 Oct 2023 18:09:38 +0800 Subject: [PATCH] Update AnomalyDetector.lua --- src/DistributedComputing/AnomalyDetector.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/DistributedComputing/AnomalyDetector.lua b/src/DistributedComputing/AnomalyDetector.lua index 2c0124d..3e8147f 100644 --- a/src/DistributedComputing/AnomalyDetector.lua +++ b/src/DistributedComputing/AnomalyDetector.lua @@ -151,7 +151,9 @@ end function AnomalyDetector:onPredictedValueReceived(WatchingPlayer: Player, WatchedPlayer: Player, predictedValue) - if (WatchedPlayer == WatchingPlayer) and (#Players:GetPlayers() > 1) and self.OnClientAccessedFunction then self.OnClientAccessedFunction(WatchingPlayer, WatchedPlayer, predictedValue) return end + local numberOfPlayersInServer = #Players:GetPlayers() + + if (WatchedPlayer == WatchingPlayer) and (numberOfPlayersInServer > 1) and self.OnClientAccessedFunction then self.OnClientAccessedFunction(WatchingPlayer, WatchedPlayer, predictedValue) return end local watchingPlayerStringUserId = tostring(WatchingPlayer.UserId) @@ -175,7 +177,7 @@ function AnomalyDetector:onPredictedValueReceived(WatchingPlayer: Player, Watche for watchedByPlayerStringUserId, otherPredictedValue in watchedPlayerReceivedPredictedValues do - if (watchedByPlayerStringUserId == watchingPlayerStringUserId) and (#Players:GetPlayers() > 1) then continue end + if (watchedByPlayerStringUserId == watchingPlayerStringUserId) and (numberOfPlayersInServer > 1) then continue end local PlayerToSet: Player = Players:GetPlayerByUserId(tonumber(watchedByPlayerStringUserId))