我看着就如何使在Roblox一个捐赠按钮,YouTube视频和遵循的步骤。但后来,当我用它,它给了我多个错误。
我试图改变.connect
到:Connect
,但它给了我更多的错误,我试图改变end)
到end
,但它给了我更多的错误。
码:
local id = 459818680
script.Parent.TextButton.MouseButton1Click.connect()(function()
game:GetService("MarketplaceService"):PromptProductPurchase
(game.Players.LocalPlayer, id)
end)
我希望能够点击它的时候我测试和购买的菜单会弹出。没啥事儿。我也有这样的错误:
Players.ImNotKevPlayz.PlayerGui.ScreenGui.LocalScript:4:坏参数#1 '连接'(RBXScriptSignal预期,有没有价值)
当我试图在Roblox命令调试命令,它给了我这个错误:
错误的脚本:“=”附近会有'
Heyo,你的脚本几乎工作,它只是看起来像你刚刚有一些语法错误。
bad argument #1 to 'connect' (RBXScriptSignal expected, got no value)
这意味着MouseButton1:Connect功能在等一个说法,但是你没有给它任何东西。
试用此修复程序:
local id = 459818680
local targetButton = script.Parent.TextButton
local MarketplaceService = game:GetService("MarketplaceService")
targetButton.MouseButton1Click:Connect(function() -- <-- this just needed to be fixed
local player = game.Players.LocalPlayer
MarketplaceService:PromptProductPurchase(player, id)
end)