diff --git a/src/client/Pets.lua b/src/client/Pets.lua index b484a88..d3e5909 100644 --- a/src/client/Pets.lua +++ b/src/client/Pets.lua @@ -12,7 +12,7 @@ local petsFolder = workspace.PetModels local playerName = Players.LocalPlayer.Name local function setPetEnabled(pet, enabled) - pet.PetUI.Enabled = enabled + pet:WaitForChild("PetUI").Enabled = enabled for _, part in pet:GetChildren() do if part:IsA "BasePart" then part.Transparency = if enabled then 0 else 1 @@ -27,7 +27,7 @@ local function updateMyPets(show) end for _, pet in playerPetFolder:GetChildren() do - setPetEnabled(pet, show) + task.spawn(setPetEnabled, pet, show) end end end @@ -39,25 +39,29 @@ local function updateOtherPets(show) end for _, pet in playerPetFolder:GetChildren() do - setPetEnabled(pet, show) + task.spawn(setPetEnabled, pet, show) end end end -petsFolder.DescendantAdded:Connect(function(descendant) - if not descendant:FindFirstChild "PetUI" then - return - end - - if descendant.Parent.Name == playerName then - if not selectors.getSetting(store:getState(), playerName, "ShowMyPets") then - setPetEnabled(descendant, false) - end - return +local function handleSubPetFolder(subPetFolder) + if subPetFolder.Name == playerName then + updateMyPets(selectors.getSetting(store:getState(), playerName, "ShowMyPets")) + subPetFolder.ChildAdded:Connect(function() + updateMyPets(selectors.getSetting(store:getState(), playerName, "ShowMyPets")) + end) + else + updateOtherPets(selectors.getSetting(store:getState(), playerName, "ShowOtherPets")) + subPetFolder.ChildAdded:Connect(function() + updateOtherPets(selectors.getSetting(store:getState(), playerName, "ShowOtherPets")) + end) end +end - if not selectors.getSetting(store:getState(), descendant.Parent.Name, "ShowOtherPets") then - setPetEnabled(descendant, false) +petsFolder.ChildAdded:Connect(handleSubPetFolder) +task.spawn(function() + for _, player in Players:GetPlayers() do + handleSubPetFolder(petsFolder:WaitForChild(player.Name)) end end) diff --git a/src/client/UI/CodesUI.lua b/src/client/UI/CodesUI.lua index 7ef8a13..e704c16 100644 --- a/src/client/UI/CodesUI.lua +++ b/src/client/UI/CodesUI.lua @@ -4,11 +4,14 @@ local ReplicatedStorage = game:GetService "ReplicatedStorage" local Remotes = require(ReplicatedStorage.Common.Remotes) local CentralUI = require(StarterPlayer.StarterPlayerScripts.Client.UI.CentralUI) +local interfaces = require(StarterPlayer.StarterPlayerScripts.Client.UI.CollidableInterfaces) local player = Players.LocalPlayer local CodesUI = CentralUI.new(player.PlayerGui:WaitForChild "Codes") function CodesUI:_initialize() + interfaces[self] = true + player.PlayerGui:WaitForChild("MainUI").Codes.Activated:Connect(function() self:setEnabled(not self._isOpen) end) diff --git a/src/client/UI/SettingsUI.lua b/src/client/UI/SettingsUI.lua index 5f1447c..b178a55 100644 --- a/src/client/UI/SettingsUI.lua +++ b/src/client/UI/SettingsUI.lua @@ -9,6 +9,7 @@ local Remotes = require(ReplicatedStorage.Common.Remotes) local selectors = require(ReplicatedStorage.Common.State.selectors) local store = require(StarterPlayer.StarterPlayerScripts.Client.State.Store) local CentralUI = require(StarterPlayer.StarterPlayerScripts.Client.UI.CentralUI) +local interfaces = require(StarterPlayer.StarterPlayerScripts.Client.UI.CollidableInterfaces) local playerStatePromise = require(StarterPlayer.StarterPlayerScripts.Client.State.PlayerStatePromise) local gamepassIDs = ReplicatedStorage.Config.GamepassData.IDs @@ -17,9 +18,13 @@ local SettingsUI = CentralUI.new(player.PlayerGui:WaitForChild "Settings") local function shouldRefresh(newState, oldState) return selectors.getTempSettings(newState, player.Name) ~= selectors.getTempSettings(oldState, player.Name) or selectors.getSavedSettings(newState, player.Name) ~= selectors.getSavedSettings(oldState, player.Name) + or selectors.hasGamepass(newState, player.Name, "2xSpeed") + and not selectors.hasGamepass(oldState, player.Name, "2xSpeed") end function SettingsUI:_initialize(): () + interfaces[self] = true + for _, settingSwitch in self._ui.Background.ScrollingFrame:GetChildren() do if not settingSwitch:FindFirstChild "On" then continue diff --git a/src/client/UI/Shops/RobuxShop.lua b/src/client/UI/Shops/RobuxShop.lua index 401a435..db6c34e 100644 --- a/src/client/UI/Shops/RobuxShop.lua +++ b/src/client/UI/Shops/RobuxShop.lua @@ -12,6 +12,7 @@ local rankUtils = require(ReplicatedStorage.Common.Utils.RankUtils) local selectors = require(ReplicatedStorage.Common.State.selectors) local store = require(StarterPlayer.StarterPlayerScripts.Client.State.Store) local CentralUI = require(StarterPlayer.StarterPlayerScripts.Client.UI.CentralUI) +local interfaces = require(StarterPlayer.StarterPlayerScripts.Client.UI.CollidableInterfaces) local playerStatePromise = require(StarterPlayer.StarterPlayerScripts.Client.State.PlayerStatePromise) local gamepassIDs = ReplicatedStorage.Config.GamepassData.IDs @@ -91,6 +92,8 @@ function RobuxShop:_countdownDescriptionDisplayTime() end function RobuxShop:_initialize(): () + interfaces[self] = true + mainUI.RobuxShop.Activated:Connect(function() self:setEnabled(not self._isOpen) end) diff --git a/src/server/Combat/FearEffects.lua b/src/server/Combat/FearEffects.lua index b8e84d9..4d78970 100644 --- a/src/server/Combat/FearEffects.lua +++ b/src/server/Combat/FearEffects.lua @@ -48,30 +48,43 @@ end local defaultWalkSpeed = 14 local walkSpeedFearDebuff = -4 + +local function updatePlayerFearEffects(player, newState, oldState) + local hasDoubleSpeed = selectors.hasGamepass(newState, player.Name, "2xSpeed") + and selectors.getSetting(newState, player.Name, "2xSpeed") + local modifiedDebuff = walkSpeedFearDebuff * (hasDoubleSpeed and 2 or 1) + local newWalkSpeed = defaultWalkSpeed * (hasDoubleSpeed and 2 or 1) + if isScared(player.Name, newState) then + task.spawn(trackPlayerScaredStatus, player) + newWalkSpeed += modifiedDebuff + elseif oldState and isScared(player.Name, oldState) then + newWalkSpeed -= modifiedDebuff + end + local humanoid = if player.Character then player.Character:FindFirstChild "Humanoid" else nil + if humanoid and humanoid.WalkSpeed ~= newWalkSpeed then + humanoid.WalkSpeed = newWalkSpeed + end + if + oldState + and selectors.isPlayerLoaded(oldState, player.Name) + and selectors.hasGamepass(newState, player.Name, "2xFearMeter") + and not selectors.hasGamepass(oldState, player.Name, "2xFearMeter") + then + store:dispatch(actions.setPlayerStat(player.Name, "CurrentFearMeter", 0)) + end +end + store.changed:connect(function(newState, oldState) for _, player in Players:GetPlayers() do - local hasDoubleSpeed = selectors.hasGamepass(newState, player.Name, "2xSpeed") - and selectors.getSetting(newState, player.Name, "2xSpeed") - local modifiedDebuff = walkSpeedFearDebuff * (hasDoubleSpeed and 2 or 1) - local newWalkSpeed = defaultWalkSpeed * (hasDoubleSpeed and 2 or 1) - if isScared(player.Name, newState) then - task.spawn(trackPlayerScaredStatus, player) - newWalkSpeed += modifiedDebuff - elseif isScared(player.Name, oldState) then - newWalkSpeed -= modifiedDebuff - end - local humanoid = if player.Character then player.Character:FindFirstChild "Humanoid" else nil - if humanoid and humanoid.WalkSpeed ~= newWalkSpeed then - humanoid.WalkSpeed = newWalkSpeed - end - if - selectors.isPlayerLoaded(oldState, player.Name) - and selectors.hasGamepass(newState, player.Name, "2xFearMeter") - and not selectors.hasGamepass(oldState, player.Name, "2xFearMeter") - then - store:dispatch(actions.setPlayerStat(player.Name, "CurrentFearMeter", 0)) - end + updatePlayerFearEffects(player, newState, oldState) end end) +Players.PlayerAdded:Connect(function(player: Player) + repeat + task.wait(0.5) + until selectors.isPlayerLoaded(store:getState(), player.Name) + updatePlayerFearEffects(player, store:getState()) +end) + return 0 diff --git a/src/server/PlayerManager/PlayerStatusUI.lua b/src/server/PlayerManager/PlayerStatusUI.lua index ac806d4..91ae048 100644 --- a/src/server/PlayerManager/PlayerStatusUI.lua +++ b/src/server/PlayerManager/PlayerStatusUI.lua @@ -39,12 +39,19 @@ function PlayerStatusUI:_updateUIFields(state) selectors.hasGamepass(state, self._player.Name, "VIP") and selectors.getSetting(state, self._player.Name, "VipNameTag") then - self._player:SetAttribute("isVIP", true) playerUIFrame.PlayerName.TextColor3 = Color3.fromRGB(255, 193, 7) else - self._player:SetAttribute("isVIP", false) playerUIFrame.PlayerName.TextColor3 = Color3.fromRGB(255, 255, 255) end + + if + selectors.hasGamepass(state, self._player.Name, "VIP") + and selectors.getSetting(state, self._player.Name, "VipChatTag") + then + self._player:SetAttribute("isVIP", true) + else + self._player:SetAttribute("isVIP", false) + end end function PlayerStatusUI:_applyUI(character: Model)