You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to make it so that my script works in studio
What is the issue? Include screenshots / videos if possible!
The issue is that it only works ingame and doesn’t work in studio
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried deleting and redownloading studio
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
this is my script:
function Main.getCreatedGamepasses(player, assetId)
local userId = player.UserId
local gamepasses = {}
local GetGamesUrl1 = "https://games.RoProxy.com/v2/users/"
local GetGamesUrl2 = "/games?accessFilter=Public&sortOrder=Asc&limit=10"
local getGamesUrl = GetGamesUrl1..userId..GetGamesUrl2
local success,result = pcall(function()
return HttpService:GetAsync(getGamesUrl)
end)
if success then
pcall(function()
result = HttpService:JSONDecode(result)
for _,GameInfo in pairs(result["data"]) do
local gameId = GameInfo.id
local url = "https://games.RoProxy.com/v1/games/%s/game-passes?limit=100&sortOrder=Asc"
url = url:format(gameId)
local success2,result2 = pcall(function()
return HttpService:GetAsync(url)
end)
if success2 then
result2 = HttpService:JSONDecode(result2)
for _,GamepassDetail in pairs(result2["data"]) do
local gamepassId = GamepassDetail.id
table.insert(gamepasses,gamepassId)
end
end
end
end)
end
return gamepasses
end
game.Players.PlayerAdded:Connect(function(plr)
local UploadFrame = plr:WaitForChild("PlayerGui"):WaitForChild("MarketplaceGui"):WaitForChild("UploadFrame")
local MarketplaceFrame = plr:WaitForChild("PlayerGui"):WaitForChild("MarketplaceGui"):WaitForChild("MarketplaceFrame")
local SellingFrame = UploadFrame:WaitForChild("SellingFrame")
local RefreshButton = SellingFrame:WaitForChild("RefreshButton")
local UploadButton = MarketplaceFrame:WaitForChild("UploadButton")
local CreatedGamepasses = Main.getCreatedGamepasses(plr)
Main.LoadPricesFrame(plr, CreatedGamepasses)
RefreshButton.MouseButton1Click:Connect(function() --Refresh Button Script
local PlayerGui = plr:WaitForChild("PlayerGui")
local PricesFrame = PlayerGui:WaitForChild("MarketplaceGui"):WaitForChild("UploadFrame"):WaitForChild("SellingFrame"):WaitForChild("PricesFrame")
local PriceTemplate = PricesFrame:WaitForChild("PriceTemplate")
local NumberOfFrames = PricesFrame:GetChildren()
for i, v in NumberOfFrames do
if v.Name == "PriceButton" then
v:Destroy()
end
i += 1
end
local CreatedGamepasses = Main.getCreatedGamepasses(plr)
Main.LoadPricesFrame(plr, CreatedGamepasses)
local InventoryTable = Main.ConvertToTable(plr:WaitForChild("Data"):WaitForChild("Inventory").Value)
Main.UpdateInventory(plr, plr.PlayerGui.MarketplaceGui.UploadFrame.SellingFrame.ItemsFrame, InventoryTable)
end)
plr:WaitForChild("Data"):WaitForChild("Inventory").Changed:Connect(function()
local InventoryTable = Main.ConvertToTable(plr:WaitForChild("Data"):WaitForChild("Inventory").Value)
Main.UpdateInventory(plr, plr.PlayerGui.MarketplaceGui.UploadFrame.SellingFrame.ItemsFrame, InventoryTable)
end)
UploadedItem.OnServerEvent:Connect(function(plr, GamepassId, Card)
local PlayerName = plr.Name
local Price = MarketplaceService:GetProductInfo(GamepassId, Enum.InfoType.Gamepass).PriceInRobux
UploadedItem:FireAllClients(PlayerName, Price, Card)
end)
end)
keep in mind that a lot of this has nothing to do w/ the problem
Ok but if you add prints you can see what is happening. Not only if it is firing but also what info it is using. So you can add prints after each “if statements” and one to print(gamepasses) at the end before the return.