Hi, I am trying to fix a bug in my roblox game, basically what happens is on PC, the shop UI (purchase buttons) work, when you click them, it prompts you to buy a gamepass, however when you are on tablet or phone, and you click on the buy button, nothing happens, I can’t seem to figure out why. If anyone can help me that would be create, I’ll provide a copy of my shop ui script below.
Does anyone know where in my script that I’m missing something? Thanks!
I’ve also removed some of my IDs for privacy reasons! Please help me if you can.
local ShopUIHandler = {
ActiveBoosts = {
Speed = 0
},
Gifting = nil
}
local Players = game:GetService("Players")
local Market = game:GetService("MarketplaceService")
local RS = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local main = player:WaitForChild("PlayerGui"):WaitForChild("Main")
local menus = main:WaitForChild("Menus")
local shopFrame = menus:WaitForChild("Shop")
local giftFrame = menus:WaitForChild("Gift")
local giftContents = giftFrame:WaitForChild("PlayerList")
local hudleft = main:WaitForChild("HUDLeft")
local menuButton = hudleft:WaitForChild("Buttons"):WaitForChild("Top"):WaitForChild("Shop")
local shopContents = shopFrame:WaitForChild("Contents")
local boostDisplay = main:WaitForChild("Boosts")
local hoverTooltips = main:WaitForChild("Tooltips"):WaitForChild("Hover")
local GUIHandler = require(script.Parent)
local TooltipHandler = require(script.Parent.Parent.TooltipHandler)
local EventsHandler = require(RS.Modules.EventsHandler)
local FormatTime = require(RS.Modules.FormatTime)
local ViewportHandler = require(RS.Modules.ViewportHandler)
local WorldsConfig = require(RS.Modules.Configuration.WorldConfig)
local WorldsList = require(RS.Modules.Configuration.WorldConfig.WorldsList)
local HeroUIHandler = require(script.Parent.HeroUIHandler)
local HeroesConfig = require(RS.Modules.Configuration.HeroesConfig)
local Abbreviate = require(RS.Modules.AbbreviateHandler)
local ShopConfig = require(RS.Modules.Configuration.ShopConfig)
local CommaNumber = require(RS.Modules.CommaNumber)
local TwitterVerifyUIHandler = require(script.Parent.TwitterVerifyUIHandler)
local NotificationHandler = require(script.Parent.Parent.NotificationHandler)
local Passes = { REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE}
local mainPasses = {
[REMOVEDFROMEXAMPLE] = Color3.fromRGB(0, 174, 255),
[REMOVEDFROMEXAMPLE] = Color3.fromRGB(0, 174, 0),
[REMOVEDFROMEXAMPLE] = Color3.fromRGB(255, 0, 72),
[REMOVEDFROMEXAMPLE] = Color3.fromRGB(255, 198, 0)
}
local Coins = { REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE, REMOVEDFROMEXAMPLE}
local Boosts = {
Coins = {
["15mins"] = REMOVEDFROMEXAMPLE,
["1hour"] = REMOVEDFROMEXAMPLE
},
Damage = {
["15mins"] = REMOVEDFROMEXAMPLE,
["1hour"] = REMOVEDFROMEXAMPLE
},
Luck = {
["15mins"] = REMOVEDFROMEXAMPLE,
["1hour"] = REMOVEDFROMEXAMPLE
}
}
local Heroes = {
Common = REMOVEDFROMEXAMPLE,
Rare = REMOVEDFROMEXAMPLE,
Epic = REMOVEDFROMEXAMPLE,
Legendary = REMOVEDFROMEXAMPLE
}
local boostImgs = {
Coins = "rbxassetid://REMOVEDFROMEXAMPLE",
Damage = "rbxassetid://REMOVEDFROMEXAMPLE",
Luck = "rbxassetid://REMOVEDFROMEXAMPLE",
Pack = "rbxassetid://REMOVEDFROMEXAMPLE"
}
local rarities = {
Common = { ColorSequence.new(Color3.fromRGB(154, 154, 154), Color3.fromRGB(231, 231, 231)), 1 },
Rare = { ColorSequence.new(Color3.fromRGB(0, 114, 220), Color3.fromRGB(0, 234, 255)), 2 },
Epic = { ColorSequence.new(Color3.fromRGB(67, 0, 220), Color3.fromRGB(180, 0, 255)), 3 },
Legendary = { ColorSequence.new(Color3.fromRGB(220, 83, 0), Color3.fromRGB(255, 186, 0)), 4 }
}
local currentDay
function ShopUIHandler:OpenFrame(FrameChosen)
local frameFound = shopContents:FindFirstChild(FrameChosen)
if not frameFound then return end
for _,v in pairs(shopContents:GetChildren()) do
v.Visible = false
end
frameFound.Visible = true
end
local function cacheProperty(object: Instance, property: string)
if not object:GetAttribute("OG"..property) then
object:SetAttribute("OG"..property, object[property])
end
return object:GetAttribute("OG"..property)
end
local function UpdateScaling(viewportSize, resolutionScale)
local newSize = 50
if resolutionScale <= 0.55 then
newSize = 35
elseif resolutionScale <= 0.75 then
newSize = 45
end
boostDisplay:FindFirstChildOfClass("UIGridLayout").CellSize = UDim2.fromOffset(newSize, newSize)
RunService.RenderStepped:Wait()
for _, item: Instance in ipairs(shopContents:GetDescendants()) do
if item.ClassName == "UIListLayout" then
local ogPadding = cacheProperty(item, "Padding")
item.Padding = UDim.new(ogPadding.Scale, ogPadding.Offset * resolutionScale)
elseif item.ClassName == "UIGridLayout" then
local ogPadding = cacheProperty(item, "CellPadding")
item.CellPadding = UDim2.new(ogPadding.X.Scale, ogPadding.X.Offset * resolutionScale, ogPadding.Y.Scale, ogPadding.Y.Offset * resolutionScale)
end
end
for _, section in ipairs(shopContents:GetChildren()) do
if not section:IsA("GuiBase2d") then continue end
local ogSize = cacheProperty(section, "Size")
section.Size = UDim2.new(0.975, 0, 0, ogSize.Y.Offset * resolutionScale)
local ogTextSize = cacheProperty(section.Title, "Size")
section.Title.Size = UDim2.new(0.5, 0, 0, ogTextSize.Y.Offset * resolutionScale)
local contentsSize = section.Contents.Size
section.Contents.Size = UDim2.new(contentsSize.X.Scale, contentsSize.X.Offset, contentsSize.Y.Scale, -(ogTextSize.Y.Offset * resolutionScale))
end
-- gift
local playersToShow
if resolutionScale <= 0.5 then
playersToShow = 3
elseif resolutionScale <= 1.2 then
playersToShow = 4
else
playersToShow = 5
end
local giftCell = giftContents.AbsoluteSize.Y / playersToShow - giftContents.UIListLayout.Padding.Offset
for _, setting in ipairs(giftContents:GetChildren()) do
if not setting:IsA("GuiBase2d") then continue end
setting.Size = UDim2.new(.92, 0, 0, giftCell)
end
giftContents.CanvasSize = UDim2.fromOffset(0, giftContents.UIListLayout.AbsoluteContentSize.Y + 10)
-- featured heroes
local heroCell = shopContents.Featured.Contents.AbsoluteSize.X / 4 - shopContents.Featured.Contents.UIListLayout.Padding.Offset
for _, hero in ipairs(shopContents.Featured.Contents:GetChildren()) do
if not hero:IsA("GuiBase2d") then continue end
hero.Size = UDim2.new(0, heroCell, 1, 0)
end
--passes
--local mainPassCellX = shopContents.Passes.Contents.Main.AbsoluteSize.X / 2 - shopContents.Passes.Contents.Main.UIGridLayout.CellPadding.X.Offset
--local mainPassCellY = shopContents.Passes.Contents.Main.AbsoluteSize.Y / 2 - shopContents.Passes.Contents.Main.UIGridLayout.CellPadding.Y.Offset
--shopContents.Passes.Contents.Main.UIGridLayout.CellSize = UDim2.fromOffset(mainPassCellX, mainPassCellY)
--local passCell = shopContents.Passes.Contents.Normal.AbsoluteSize.X / 4 - shopContents.Passes.Contents.Normal.UIGridLayout.CellPadding.X.Offset
--shopContents.Passes.Contents.Normal.UIGridLayout.CellSize = UDim2.new(0, passCell, .281, 0)
--boosts
local boostSize = shopContents.Boosts.Contents.AbsoluteSize.Y / (#shopContents.Boosts.Contents:GetChildren() - 1) - shopContents.Boosts.Contents.UIListLayout.Padding.Offset
for _, setting in ipairs(shopContents.Boosts.Contents:GetChildren()) do
if not setting:IsA("GuiBase2d") then continue end
setting.Size = UDim2.new(1, 0, 0, boostSize)
end
-- coins
local coinCell = shopContents.Coins.Contents.Group.AbsoluteSize.X / 3 - shopContents.Coins.Contents.Group.UIGridLayout.CellPadding.X.Offset
shopContents.Coins.Contents.Group.UIGridLayout.CellSize = UDim2.new(0, coinCell, .475, 0)
--shopContents.CanvasSize = UDim2.fromOffset(0, shopContents.UIListLayout.AbsoluteContentSize.Y + 10)
end
local function UpdateOwnedPasses(passesData)
for _, location in ipairs({ "Main", "Normal" }) do
for _, pass in ipairs(shopContents:WaitForChild("Passes"):WaitForChild("Contents"):WaitForChild(location):GetChildren()) do
if not pass:IsA("GuiBase2d") then continue end
local passOwned = table.find(passesData, tostring(pass.GamepassID.Value))
pass.Price.Robux.Text = if passOwned then "OWNED" else (if pass.PriceInRobux.Value == -1 then "Not For Sale" else pass.PriceInRobux.Value)
pass.Price.Robux.TextColor3 = if passOwned then Color3.new(0, 1, 0) else Color3.new(1, 1, 1)
pass.Price.RobuxIcon.Visible = not (pass.PriceInRobux.Value == -1 or passOwned)
end
end
end
local function UpdateGift()
for _, frame in ipairs(giftContents:GetChildren()) do
if frame:IsA("GuiBase2d") then
frame:Destroy()
end
end
for _, plr in ipairs(Players:GetPlayers()) do
if plr == player then continue end
local GiftTemplate = RS.GUITemplates.GiftTemplate:Clone()
GiftTemplate.Name = plr.Name
GiftTemplate.PlayerName.Text = if (plr.DisplayName == "" or plr.DisplayName == plr.Name) then plr.Name else string.format("%s (@%s)", plr.DisplayName, plr.Name)
local s, AvatarImage = pcall(function()
return Players:GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
end)
GiftTemplate.PlayerIcon.Image = s and AvatarImage or ""
GiftTemplate.Activated:Connect(function()
local ownedGamepasses, highestWorld = EventsHandler:ClientCall("Gift", plr)
if ownedGamepasses and highestWorld and type(ownedGamepasses) == "table" then
ShopUIHandler.Gifting = plr
local name = if (plr.DisplayName == "" or plr.DisplayName == plr.Name) then plr.Name else plr.DisplayName
shopFrame.Gifting.Text = "Gifting ".. name
UpdateOwnedPasses(ownedGamepasses)
ShopUIHandler:UpdateShopValues(highestWorld)
NotificationHandler:SetOutput("You are now gifting ".. name .."!")
end
GUIHandler:OpenFrame("Shop")
end)
GiftTemplate.Visible = true
GiftTemplate.Parent = giftContents
end
if GUIHandler.ViewportSize ~= nil then
UpdateScaling(GUIHandler.ViewportSize, GUIHandler.ResolutionScale)
end
end
local function GetHighestWorld(plr)
local ownedWorlds = EventsHandler:ClientCall("GetWorlds", plr)
local highestWorld = "Superhero Island"
for _, world in ipairs(WorldsList) do
if world:split(" ")[1] == "Dungeon" or table.find({ "Dungeons Hub", "Raid", "Boss" }, world) then continue end
if table.find(ownedWorlds, world) then
highestWorld = world
else
break
end
end
return highestWorld
end
function ShopUIHandler:UpdateShopValues(highestWorld: string?)
if highestWorld == nil then
highestWorld = GetHighestWorld(ShopUIHandler.Gifting)
end
for i, productID in ipairs(Coins) do
local parent = if i == 7 then shopContents.Coins.Contents else shopContents.Coins.Contents.Group
local coinButton = parent:WaitForChild("Coins"..i)
if not coinButton then
warn("[ShopUIHandler] Coin button #"..i.." does not exist! ("..productID..")")
continue
end
coinButton.Amount.Text = CommaNumber(WorldsConfig[highestWorld][4] * ShopConfig.CoinMultipliers[i])
end
for rarity, data in pairs(rarities) do
local heroButton = shopContents:WaitForChild("Featured"):WaitForChild("Contents"):WaitForChild(rarity)
local level = WorldsConfig[highestWorld][5]
local damage = HeroUIHandler:GetHeroDamage(HeroesConfig[heroButton.HeroName.Text], level)
heroButton.Damage.Text = Abbreviate(damage)
end
end
function ShopUIHandler:ResetGiftingPerson()
if shopFrame.Gifting.Text == "" and self.Gifting == nil then return end
local name = if (self.Gifting.DisplayName == "" or self.Gifting.DisplayName == self.Gifting.Name) then self.Gifting.Name else self.Gifting.DisplayName
EventsHandler:ClientCall("Gift", nil)
UpdateOwnedPasses(EventsHandler:ClientCall("GetOwnedPasses"))
self.Gifting = nil
self:UpdateShopValues()
shopFrame.Gifting.Text = ""
NotificationHandler:SetOutput("Removed ".. name .." from gifting!", nil, Color3.fromRGB(255, 0, 0))
end
local tooltips = {}
local function createBoost(boostName)
if boostDisplay:FindFirstChild(boostName) or not ShopConfig.Boosts[boostName] then return end
local boost = RS.GUITemplates.Boost:Clone()
boost.Name = boostName
boost.TimeLeft.Text = ""
boost.Icon.Image = ShopConfig.Boosts[boostName][1]
boost.LayoutOrder = table.find(ShopConfig.Boosts, boostName)
boost.Parent = boostDisplay
tooltips[boostName] = TooltipHandler(boost, ShopConfig.Boosts[boostName][2], 1, boostName.."Boost")
return boost
end
function ShopUIHandler:Insufficient()
GUIHandler:OpenFrame("Shop")
ShopUIHandler:OpenFrame("Coins")
end
function ShopUIHandler:UpdateBoostInventory(data, silent)
for boostID, amount in pairs(data) do
if not ShopConfig.Inventory[boostID] then continue end
local boostName, duration = unpack(boostID:split("-"))
local boost = shopContents.Boosts.Contents:FindFirstChild(boostID)
if not boost then continue end
boost.Buttons.Use.TextLabel.Text = "Use"..(if amount > 0 then " ("..amount..")" else "")
end
if (not menuButton.Notification.Visible) and (not silent) then
menuButton.Notification.Visible = true
end
end
local function updateFeaturedHeroes(newHeroes: table, silent: boolean?)
if newHeroes == nil then
newHeroes = EventsHandler:ClientCall("UpdateExcShop")
end
for rarity, hero in pairs(newHeroes) do
shopContents.Featured.Contents:WaitForChild(rarity).HeroName.Text = hero
if shopContents.Featured.Contents[rarity].Photo:FindFirstChildOfClass("ViewportFrame") then
shopContents.Featured.Contents[rarity].Photo:FindFirstChildOfClass("ViewportFrame"):Destroy()
end
ViewportHandler:AddHeroIntoView(hero, shopContents.Featured.Contents[rarity].Photo, 5, { SetOffset = Vector3.new(0, 0.8, 0) })
ShopUIHandler:UpdateShopValues()
end
if (not silent) then
menuButton.Notification.Visible = true
end
end
function ShopUIHandler:Init()
EventsHandler:ClientListen("LoadInventory", function(inventoryData, silent)
ShopUIHandler:UpdateBoostInventory(inventoryData.Boosts, silent)
end)
EventsHandler:ClientListen("CreateVerifiedBoostIcon", function()
local boost = createBoost("Verified")
boost.TimeLeft.Text = "∞"
TwitterVerifyUIHandler:Verified()
end)
EventsHandler:ClientListen("UpdateExcShop", updateFeaturedHeroes)
EventsHandler:ClientListen("UpdateBoosts", function(boostData)
for boostName, duration in pairs(boostData) do
if duration <= 0 then
if tooltips[boostName] then
tooltips[boostName]()
tooltips[boostName] = nil
end
if boostDisplay:FindFirstChild(boostName) then
boostDisplay[boostName]:Destroy()
end
continue
end
local boost = if boostDisplay:FindFirstChild(boostName) then boostDisplay[boostName] else createBoost(boostName)
boost.TimeLeft.Text = if duration > 86400 then FormatTime:TimeString(duration) else FormatTime:AdaptiveTime(duration)
if duration > 86400 then
if hoverTooltips:FindFirstChild(boostName.."Boost") then
hoverTooltips[boostName.."Boost"].Text = ShopConfig.Boosts[boostName][2].." ("..FormatTime:AdaptiveTime(duration)..")"
end
if tooltips[boostName] then
tooltips[boostName]()
end
tooltips[boostName] = TooltipHandler(boost, ShopConfig.Boosts[boostName][2].." ("..FormatTime:AdaptiveTime(duration)..")", 1, boostName.."Boost")
end
end
ShopUIHandler.ActiveBoosts = boostData
end)
EventsHandler:ClientListen("Gift", function(receiver, receiverPasses)
if receiver == ShopUIHandler.Gifting then
UpdateOwnedPasses(receiverPasses)
end
end)
for i, gamepassID in ipairs(Passes) do
task.spawn(function()
local s, marketInfo = pcall(function()
return Market:GetProductInfo(gamepassID, Enum.InfoType.GamePass)
end)
local template = if mainPasses[gamepassID] then RS.GUITemplates.MainPassesTemplate:Clone() else RS.GUITemplates.PassesTemplate:Clone()
template.GamepassName.Text = if (s and marketInfo) then marketInfo.Name else "Failed to load"
template:FindFirstChild("GamepassID").Value = gamepassID
template.LayoutOrder = i
if mainPasses[gamepassID] then
template.BackgroundColor3 = mainPasses[gamepassID]
end
if s and marketInfo then
template.Name = marketInfo.Name
template:FindFirstChild("PriceInRobux").Value = if marketInfo.IsForSale then marketInfo.PriceInRobux else -1
template.Price.Robux.Text = if (marketInfo.IsForSale and marketInfo.PriceInRobux) then marketInfo.PriceInRobux else "Not For Sale"
template.Icon.Image = "rbxassetid://"..marketInfo.IconImageAssetId
template.Description.Text = marketInfo.Description
end
template.Activated:Connect(function()
EventsHandler:ClientCall("BuyPass", gamepassID)
end)
template.Parent = shopContents:WaitForChild("Passes"):WaitForChild("Contents"):WaitForChild(if mainPasses[gamepassID] then "Main" else "Normal")
end)
end
local highestWorld = GetHighestWorld()
for i, productID in ipairs(Coins) do
task.spawn(function()
local marketInfo
local s, e = pcall(function()
marketInfo = Market:GetProductInfo(productID, Enum.InfoType.Product)
end)
if i == 7 then
local coins7 = shopContents.Coins.Contents.Coins7
coins7.Amount.Text = CommaNumber(WorldsConfig[highestWorld][4] * ShopConfig.CoinMultipliers[i])
coins7.Price.Robux.Text = if marketInfo and marketInfo.PriceInRobux then CommaNumber(marketInfo.PriceInRobux) else "Failed to load"
coins7.Activated:Connect(function()
Market:PromptProductPurchase(player, productID)
GUIHandler:SetPurchaseLoading(true)
end)
else
local template = RS.GUITemplates.CoinsTemplate:Clone()
template.Name = "Coins"..i
template.Amount.Text = CommaNumber(WorldsConfig[highestWorld][4] * ShopConfig.CoinMultipliers[i])
template.Price.Text = if marketInfo and marketInfo.PriceInRobux then CommaNumber(marketInfo.PriceInRobux) else "Failed to load"
template.LayoutOrder = -i
if marketInfo then
template.Icon.Image = "rbxassetid://"..marketInfo.IconImageAssetId
end
template.Activated:Connect(function()
Market:PromptProductPurchase(player, productID)
GUIHandler:SetPurchaseLoading(true)
end)
template.Parent = shopContents.Coins.Contents.Group
end
end)
end
local boostPack = shopContents.Boosts.Contents.BoostPack
local s, boostPackInfo = pcall(function()
return Market:GetProductInfo(1241483963, Enum.InfoType.Product)
end)
boostPack.Buttons.Buy.TextLabel.Text = if (s and boostPackInfo) then boostPackInfo.PriceInRobux else "Failed to load"
boostPack.Buttons.Buy.Activated:Connect(function()
Market:PromptProductPurchase(player, 1241483963)
GUIHandler:SetPurchaseLoading(true)
end)
for boostName, data in pairs(Boosts) do
task.spawn(function()
local fifteentemplate = RS.GUITemplates.BoostsTemplate:Clone()
fifteentemplate.Name = boostName.."-15"
fifteentemplate.Image = boostImgs[boostName]
fifteentemplate.Time.Text = "15 Minutes"
local hourtemplate = RS.GUITemplates.BoostsTemplate:Clone()
hourtemplate.Name = boostName.."-60"
hourtemplate.Image = boostImgs[boostName]
hourtemplate.Time.Text = "60 Minutes"
local fifteenInfo, hourInfo
local s, e = pcall(function()
fifteenInfo = Market:GetProductInfo(data["15mins"], Enum.InfoType.Product)
hourInfo = Market:GetProductInfo(data["1hour"], Enum.InfoType.Product)
end)
fifteentemplate.Buttons.Buy.TextLabel.Text = if fifteenInfo then fifteenInfo.PriceInRobux else "Failed to load"
hourtemplate.Buttons.Buy.TextLabel.Text = if hourInfo then hourInfo.PriceInRobux else "Failed to load"
fifteentemplate.Buttons.Buy.Activated:Connect(function()
Market:PromptProductPurchase(player, data["15mins"])
GUIHandler:SetPurchaseLoading(true)
end)
fifteentemplate.Buttons.Use.Activated:Connect(function()
local success, response = EventsHandler:ClientCall("UseItem", "Boosts", boostName.."-15")
if success == true then
main.Sounds.Others.Boost:Play()
else
if response == "DontHave" then
NotificationHandler:SetOutput("You don't have any of these boosts")
Market:PromptProductPurchase(player, data["15mins"])
GUIHandler:SetPurchaseLoading(true)
else
NotificationHandler:SetOutput("Unknown error")
end
end
end)
hourtemplate.Buttons.Buy.Activated:Connect(function()
Market:PromptProductPurchase(player, data["1hour"])
GUIHandler:SetPurchaseLoading(true)
end)
hourtemplate.Buttons.Use.Activated:Connect(function()
local success, response = EventsHandler:ClientCall("UseItem", "Boosts", boostName.."-60")
if success == true then
main.Sounds.Others.Boost:Play()
else
if response == "DontHave" then
NotificationHandler:SetOutput("You don't have any of these boosts")
Market:PromptProductPurchase(player, data["1hour"])
GUIHandler:SetPurchaseLoading(true)
else
NotificationHandler:SetOutput("Unknown error")
end
end
end)
fifteentemplate.Parent = shopContents.Boosts.Contents
hourtemplate.Parent = shopContents.Boosts.Contents
end)
end
for rarity, productID in pairs(Heroes) do
local template = RS.GUITemplates.FeaturedTemplate:Clone()
local marketInfo
local s, e = pcall(function()
marketInfo = Market:GetProductInfo(productID, Enum.InfoType.Product)
end)
template.Name = rarity
template.Rarity.Text = rarity
template.Rarity.UIGradient.Color = rarities[rarity][1]
template.UIGradient.Color = rarities[rarity][1]
template.LayoutOrder = rarities[rarity][2]
if marketInfo then
template.HeroName.Text = marketInfo.Name
template.Price.Text = marketInfo.PriceInRobux
end
template.Activated:Connect(function()
Market:PromptProductPurchase(player, productID)
GUIHandler:SetPurchaseLoading(true)
end)
template.Parent = shopContents:WaitForChild("Featured"):WaitForChild("Contents")
end
updateFeaturedHeroes(nil, true)
EventsHandler:ClientCall("LoadInventory", true)
for _, button in ipairs(shopFrame.Buttons:GetChildren()) do
if not button:IsA("GuiButton") then continue end
button.Activated:Connect(function()
main.Sounds.Frames.Open:Play()
ShopUIHandler:OpenFrame(button.Name)
end)
end
shopFrame.Exit.Activated:Connect(function()
GUIHandler:CloseFrame("Shop")
ShopUIHandler:ResetGiftingPerson()
end)
TooltipHandler(menuButton, "Shop", 999)
shopFrame.Gift.Activated:Connect(function()
if ShopUIHandler.Gifting == nil then
GUIHandler:OpenFrame("Gift")
else
ShopUIHandler:ResetGiftingPerson()
end
end)
menuButton.Activated:Connect(function()
if menuButton.Notification.Visible then
menuButton.Notification.Visible = false
end
if shopFrame.Visible then
GUIHandler:CloseFrame("Shop")
ShopUIHandler:ResetGiftingPerson()
else
GUIHandler:OpenFrame("Shop")
end
end)
hudleft:WaitForChild("Stats").Buy.Activated:Connect(function()
if shopFrame.Visible then
GUIHandler:CloseFrame("Shop")
ShopUIHandler:ResetGiftingPerson()
else
GUIHandler:OpenFrame("Shop")
ShopUIHandler:OpenFrame("Coins")
end
end)
giftFrame.Exit.Activated:Connect(function()
GUIHandler:OpenFrame("Shop")
end)
script.Parent.Parent["Resolution Changed"].Event:Connect(UpdateScaling)
Players.PlayerAdded:Connect(UpdateGift)
Players.PlayerRemoving:Connect(function(plrLeaving)
if ShopUIHandler.Gifting == plrLeaving then
ShopUIHandler:ResetGiftingPerson()
end
UpdateGift()
end)
UpdateGift()
RS.Modules:WaitForChild("GamepassStatus"):WaitForChild("Replicate").OnClientEvent:Connect(function()
UpdateOwnedPasses(EventsHandler:ClientCall("GetOwnedPasses"))
end)
UpdateOwnedPasses(EventsHandler:ClientCall("GetOwnedPasses"))
task.spawn(function()
while true do
-- Using % gives us the remainder, which in our case is how far into a day we are
-- Now we can easily calculate how much time is left by subtracting a day (86,400 seconds)
shopContents.Featured.ResetTimer.Text = "RESETS IN: "..FormatTime:AdaptiveTime(86400 - (math.floor(workspace:GetServerTimeNow()) % 86400))
task.wait(1)
end
end)
end
return ShopUIHandler