diff --git a/src/client/UI/BuffsUI.lua b/src/client/UI/BuffsUI.lua index f518b5d..aec7cf8 100644 --- a/src/client/UI/BuffsUI.lua +++ b/src/client/UI/BuffsUI.lua @@ -131,6 +131,7 @@ playerStatePromise:andThen(function() end end) + buffTray:WaitForChild "Frame" updateBuffTray(store:getState()) store.changed:connect(updateBuffTray) while true do diff --git a/src/client/UI/Combat/BossUI.lua b/src/client/UI/Combat/BossUI.lua index 406c8d6..eca2d6b 100644 --- a/src/client/UI/Combat/BossUI.lua +++ b/src/client/UI/Combat/BossUI.lua @@ -35,7 +35,7 @@ Remotes.Client:Get("SendFightInfo"):Connect(function(info) gemsToDisplay = getMultiplierAdjustedStat(player, "Gems", gemsToDisplay) fearToDisplay = getMultiplierAdjustedStat(player, "Fear", fearToDisplay) - BossUI.Background.Frame.Health:TweenSize( + BossUI:WaitForChild("Background").Frame.Health:TweenSize( UDim2.fromScale(1.013 * info.Health / info.MaxHealth, 1.104), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, diff --git a/src/client/UI/GiftUI.lua b/src/client/UI/GiftUI.lua index 105698c..32ade3e 100644 --- a/src/client/UI/GiftUI.lua +++ b/src/client/UI/GiftUI.lua @@ -91,6 +91,9 @@ function GiftUI:_initialize(): () end) playerStatePromise:andThen(function() + store.changed:connect(function() + self:Refresh() + end) while true do self._counter = (self._counter + 1) % 2 self:Refresh(true) diff --git a/src/server/Combat/Perks/Pets.lua b/src/server/Combat/Perks/Pets.lua index 596b4b8..537bd2c 100644 --- a/src/server/Combat/Perks/Pets.lua +++ b/src/server/Combat/Perks/Pets.lua @@ -154,6 +154,8 @@ end) Remotes.Server:Get("EquipBestPets"):Connect(function(player: Player) local equippedPets = selectors.getEquippedPets(store:getState(), player.Name) + local lockedPets = selectors.getLockedPets(store:getState(), player.Name) + local ownedPets = selectors.getOwnedPets(store:getState(), player.Name) local bestPets = petUtils.getBestPetNames( selectors.getOwnedPets(store:getState(), player.Name), selectors.getStat(store:getState(), player.Name, "MaxPetEquipCount") @@ -164,11 +166,21 @@ Remotes.Server:Get("EquipBestPets"):Connect(function(player: Player) end local bestPetsDict = {} + local petsToUnlock = table.clone(equippedPets) for _, bestPetName in bestPets do bestPetsDict[bestPetName] = (bestPetsDict[bestPetName] or 0) + 1 end - store:dispatch(actions.unlockPlayerPets(player.Name, equippedPets)) + for petName, count in bestPetsDict do + local lockCount = lockedPets[petName] or 0 + local equipCount = equippedPets[petName] or 0 + if ownedPets[petName] - (lockCount - equipCount) < count then + local countToUnlock = count - (ownedPets[petName] - (lockCount - equipCount)) + petsToUnlock[petName] = (petsToUnlock[petName] or 0) + countToUnlock + end + end + + store:dispatch(actions.unlockPlayerPets(player.Name, petsToUnlock)) store:dispatch(actions.unequipPlayerPets(player.Name, equippedPets)) store:dispatch(actions.equipPlayerPets(player.Name, bestPetsDict)) store:dispatch(actions.lockPlayerPets(player.Name, bestPetsDict, true)) diff --git a/src/server/Exchange/init.lua b/src/server/Exchange/init.lua index 231628a..ad7baa6 100644 --- a/src/server/Exchange/init.lua +++ b/src/server/Exchange/init.lua @@ -94,7 +94,10 @@ local function handlePunchingBag(bag: any) prompt.ActionText = "Start Training" inUse = false - if selectors.getStat(store:getState(), player.Name, "Strength") >= initialStrength then + if + selectors.isPlayerLoaded(store:getState(), player.Name) + and selectors.getStat(store:getState(), player.Name, "Strength") >= initialStrength + then humanoid.RootPart.CFrame = teleportPart.CFrame + Vector3.new(0, 1, 0) * (humanoid.RootPart.Size.Y + 3) end diff --git a/src/server/PlayerManager/GlobalLeaderboards.lua b/src/server/PlayerManager/GlobalLeaderboards.lua index 5d4ef63..7139db4 100644 --- a/src/server/PlayerManager/GlobalLeaderboards.lua +++ b/src/server/PlayerManager/GlobalLeaderboards.lua @@ -50,24 +50,19 @@ end local function updateGlobalLeaderboardStores(): () for _, player in Players:GetPlayers() do - if - not profiles[player.Name] - or permissionList.Admins[player.UserId] - or not selectors.isPlayerLoaded(store:getState(), player.Name) - or player.UserId < 0 - then + if not profiles[player.Name] or permissionList.Admins[player.UserId] or player.UserId < 0 then continue end for statName, globalLeaderboard in globalLeaderboardStores do + if not selectors.isPlayerLoaded(store:getState(), player.Name) then + continue + end pcall( globalLeaderboard.SetAsync, globalLeaderboard, tostring(player.UserId), math.floor(selectors.getStat(store:getState(), player.Name, statName)) ) - if not selectors.isPlayerLoaded(store:getState(), player.Name) then - continue - end end end end @@ -76,7 +71,7 @@ task.delay(10, function() while true do task.spawn(updateGlobalLeaderboardDisplays) task.spawn(updateGlobalLeaderboardStores) - task.wait(100) + task.wait(120) end end)