【发布时间】:2021-12-20 08:49:53
【问题描述】:
我已经完成了代码的主要部分,但我卡在了重要部分。这是我正在做的事情:
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local productID = 1218445231
local productInfo = MarketplaceService:GetProductInfo(productID, Enum.InfoType.Product)
script.Parent.MouseButton1Click:Connect(function()
local function promptPurchase()
local player = Players.LocalPlayer
MarketplaceService:PromptProductPurchase(player, productID)
purchased = true
end
end)
if purchased == true then
--stuck here (if you don't understand, the tsunami that I've made is supposed to become visible and start moving towards the map, however the part is in "Workspace". The button is in "StarterGUI". Please help.)
end
编辑:现在更新了代码,仍然不知道该怎么做。我可以获得工作空间服务吗?如果是这样,我如何编码将海啸的透明度设置为“0”并开始移动?这是我的代码:
local MarketplaceService = game:GetService("MarketplaceService")
local player = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PurchaseEvent = ReplicatedStorage.PurchaseEvent
local productID = 1218445231
script.Parent.MouseButton1Click:Connect(function()
PurchaseEvent:FireServer(productID)
end)
if MarketplaceService:PlayerOwnsAsset(1218445231) then
--Make tsunami become visible and start moving
end
【问题讨论】:
-
问题是什么?什么不工作?请添加更多信息,以便我们为您提供帮助。
-
您能否提供更多代码和上下文来说明您遇到的问题是什么