Hello there, Im making a game where you can donate to players from their booth. I have a script in StarterPlayerScripts where it detects if the player has clicked the gamepass. However it only works on a certain stand and no other stands. I have tested it ingame but it still doesnt work.
Here is the StarterPlayerScript:
local mps = game:GetService(“MarketplaceService”)
while wait(1) do
for _, stand in pairs(game.Workspace.Stands:GetChildren()) do
for _, frame in pairs(stand.Products.Items.ScrollingFrame:GetChildren()) do
if frame:IsA(“Frame”) and frame then
frame.RobuxCost.MouseButton1Click:Connect(function()
game.ReplicatedStorage.HeyDawhg:FireServer()
if frame.ItemTypeId.Value == 34 then
mps:PromptGamePassPurchase(game.Players.LocalPlayer,frame.ItemID.Value)
else
mps:PromptPurchase(game.Players.LocalPlayer,frame.ItemID.Value)
end
end)
end
end