我在我的 roblox 游戏通行证gui上遇到问题

我正试图在游戏中创建一个商店gui,虽然购买提示未出现,并给了我这个错误消息 Players.Miesels.PlayerGui.ShopGui.Frame.ItemButtons.PurchaseScript:10: attempt to index nil with 'Value'

这是 roblox 商店gui 的脚本

local MarketplaceService = game:GetService("MarketplaceService")
local Player = game.Players.LocalPlayer

for i, Button in pairs(script.Parent:GetChildren()) do
    if Button:IsA("ImageButton") or Button:IsA("TextButton") then

        Button.MouseButton1Click:Connect(function()
            local GamepassId = Button:FindFirstChild("GamepssId")

            MarketplaceService:PromptGamePassPurchase(Player, GamepassId.Value)
        end)

    end
end

错误信息告诉我错误出现在“(Player,GamepassId.Value)” 这是一个在服务器脚本服务中的本地脚本

原文链接 https://stackoverflow.com/questions/69504220

点赞