I am trying to make a ui that you can buy coins but for some reason when I call the marketplaceservice prompt purchase event I get the error "unable to cast value to object". Any ideas?
for _,v in pairs(PlayerGui:WaitForChild("BuyCoinsUI").Main.PackageFrame:GetChildren()) do
if v:IsA("ImageLabel") then
v.PurchaseCoins.MouseButton1Click:Connect(function()
PlayClickAudio()
if v.Name == "BasicCuberPackage" then
print("basic bought")
MarketplaceService:PromptProductPurchase(player.UserId, 975968181)
elseif v.Name == "AdvancedCuberPackage" then
print("advanced bought")
MarketplaceService:PromptProductPurchase(player.UserId, 976009690)
elseif v.Name == "LegendaryCuberPackage" then
print("legendary bought")
MarketplaceService:PromptProductPurchase(player.UserId, 976010896)
end
end)
end
end
