首页 > 解决方案 > 我的 roblox gamepass 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)”它是服务器脚本服务中的本地脚本

标签: luaroblox

解决方案


推荐阅读