diff --git a/src/client/Areas/Barriers.lua b/src/client/Areas/Barriers.lua index 656aa60..896e848 100644 --- a/src/client/Areas/Barriers.lua +++ b/src/client/Areas/Barriers.lua @@ -31,6 +31,13 @@ local AFKUnlockUIOffTween = TweenService:Create( { Transparency = 1 } ) +AFKUnlockUIOnTween.Completed:Connect(function() + task.wait(6) + AFKUnlockUIOffTween:Play() + AFKUnlockUIOffTween.Completed:Wait() + AFKUnlockUI.Visible = false +end) + local function unlockArea(areaName: string, lock: boolean?) for _, barrier in CollectionService:GetTagged(areaName .. "Barrier") do local barrierUI = barrier:FindFirstChild "BarrierLockDisplay" @@ -48,7 +55,7 @@ local function unlockArea(areaName: string, lock: boolean?) end end -local function unlockAreas() +local function unlockAreas(oldWasLoaded) for _, requirement in areaRequirements:GetChildren() do if requirement.Value > selectors.getStat(store:getState(), player.Name, "Strength") then unlockArea(requirement.Name, true) @@ -56,19 +63,20 @@ local function unlockAreas() unlockArea(requirement.Name) if not unlockedAreas[requirement.Name] then unlockedAreas[requirement.Name] = true - PopupUI("New Area Unlocked!", Color3.fromRGB(250, 250, 250)) - workspace.Beams[requirement.Name].Beam.Attachment1 = player.Character.HumanoidRootPart.RootAttachment - if requirement.Name == "Howling Woods" then + if oldWasLoaded then + PopupUI("New Area Unlocked!", Color3.fromRGB(250, 250, 250)) + end + + if workspace.Beams:FindFirstChild(requirement.Name) and oldWasLoaded then + workspace.Beams[requirement.Name].Beam.Attachment1 = + player.Character.HumanoidRootPart.RootAttachment + end + + if requirement.Name == "Howling Woods" and oldWasLoaded then AFKUnlockUI.Transparency = 1 AFKUnlockUI.Visible = true AFKUnlockUIOnTween:Play() - AFKUnlockUIOnTween.Completed:Wait() - task.delay(6, function() - AFKUnlockUIOffTween:Play() - AFKUnlockUIOffTween.Completed:Wait() - AFKUnlockUI.Visible = false - end) end end end @@ -113,7 +121,7 @@ local function handleTeleporter(teleporter) end playerStatePromise:andThen(function() - unlockAreas() + unlockAreas(false) store.changed:connect(function(newState, oldState) if selectors.isPlayerLoaded(oldState, player.Name) @@ -122,7 +130,7 @@ playerStatePromise:andThen(function() then return end - unlockAreas() + unlockAreas(selectors.isPlayerLoaded(oldState, player.Name)) end) end) diff --git a/src/client/UI/Combat/StrengthMeters.lua b/src/client/UI/Combat/StrengthMeters.lua index 55d8941..b512830 100644 --- a/src/client/UI/Combat/StrengthMeters.lua +++ b/src/client/UI/Combat/StrengthMeters.lua @@ -54,14 +54,14 @@ function StrengthMeters:Refresh(): () local strength = selectors.getStat(store:getState(), player.Name, "Strength") local newRank = selectors.getStat(store:getState(), player.Name, "Rank") - if newRank ~= self._currentRank then + if self._currentRank and newRank ~= self._currentRank then PopupUI(`You Leveled Up To Rank {newRank}!`, Color3.fromRGB(250, 250, 250)) PopupUI( `Your Fear Meter Increased To {selectors.getStat(store:getState(), player.Name, "MaxFearMeter")}!`, Color3.fromRGB(250, 250, 250) ) - self._currentRank = newRank end + self._currentRank = newRank for _, meter in meters do if not meter:IsA "ImageLabel" then diff --git a/src/client/UI/Shops/WeaponShop.lua b/src/client/UI/Shops/WeaponShop.lua index 06415af..1c8bf1e 100644 --- a/src/client/UI/Shops/WeaponShop.lua +++ b/src/client/UI/Shops/WeaponShop.lua @@ -1,4 +1,5 @@ local Players = game:GetService "Players" +local TweenService = game:GetService "TweenService" local StarterPlayer = game:GetService "StarterPlayer" local ReplicatedStorage = game:GetService "ReplicatedStorage" local MarketplaceService = game:GetService "MarketplaceService" @@ -23,6 +24,27 @@ local gamepassPrices = ReplicatedStorage.Config.GamepassData.Prices local WeaponShop = CentralUI.new(player.PlayerGui:WaitForChild "WeaponShop") local mainUI = player.PlayerGui:WaitForChild "MainUI" local confirmationUIInstance = mainUI.WeaponShop.Confirmation +local currentTargetPrice = math.huge +local lastCanAffordNotification = -1 +local canAffordNotificationUI = player.PlayerGui:WaitForChild("ScreenEffects").Unlocks.Weapon + +local canAffordNotificationUIOnTween = TweenService:Create( + canAffordNotificationUI, + TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), + { Transparency = 0 } +) +local canAffordNotificationUIOffTween = TweenService:Create( + canAffordNotificationUI, + TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), + { Transparency = 1 } +) + +canAffordNotificationUIOnTween.Completed:Connect(function() + task.wait(6) + canAffordNotificationUIOffTween:Play() + canAffordNotificationUIOffTween.Completed:Wait() + canAffordNotificationUI.Visible = false +end) WeaponShop.Trigger = "WeaponShop" WeaponShop._itemButtons = WeaponShop._ui.LeftBackground.ScrollingFrame:GetChildren() @@ -33,6 +55,18 @@ function WeaponShop:_initialize(): () return end + if + selectors.getStat(newState, player.Name, "Gems") >= currentTargetPrice + and currentTargetPrice < selectors.getStat(oldState, player.Name, "Gems") + and os.time() - lastCanAffordNotification > 300 + and selectors.isPlayerLoaded(oldState, player.Name) + then + lastCanAffordNotification = os.time() + canAffordNotificationUI.Transparency = 1 + canAffordNotificationUI.Visible = true + canAffordNotificationUIOnTween:Play() + end + if selectors.getEquippedWeapon(newState, player.Name) ~= selectors.getEquippedWeapon(oldState, player.Name) or not Table.ShallowIsEqual( @@ -205,6 +239,11 @@ function WeaponShop:Refresh(): () button.GemPrice.Visible = true button.Icon.Visible = true restAreLocked = true + + local price = weapons[button.Name]:FindFirstChild "Price" + if price then + currentTargetPrice = price.Value + end else -- this item is not unlocked button.Locked.Visible = true