我需要一个可以在 Roblox 中启动 GUI 的脚本吗?
如何让脚本在触摸砖块时调出商店 GUI?
我应该如何在商店 GUI 中制作“购买”东西?
How do I make a script bring up a shop GUI when a brick is touched?
And how should I make the "buy" stuff in the shop GUI?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要自己制作商店界面,
但我会给你“GUI Giver”脚本。
注意:您必须将脚本放在程序块/零件内部中。
You will be needing to make that Shop Interface yourself,
but i will give you the "GUI Giver" script.
Note: You must put the Script Inside the Brick/Part.
编写一个脚本,将砖块的“Touched”事件连接到使用游戏的“getPlayerFromCharacter”方法的函数。玩家找到玩家,然后将 GUI 插入玩家的“PlayerGui”中。例如:
Make a script that connects a brick's 'Touched' event to a function which uses the "getPlayerFromCharacter" method of game.Players to find the player then inserts the GUI into the player's "PlayerGui". For example:
以下代码可用于为玩家提供商店 GUI:
请注意,“ShopPart”应该是覆盖整个商店区域的一个大部分(最好是不可见的)
然后您还必须构建一个商店 GUI。
在商店 GUI 中,您应该制作文本按钮(或图像按钮),每个按钮都包含以下脚本:
该代码未经测试,因此可能包含错误。而且您可能需要更改的内容比提到的更多。但它应该能让你了解如何制作商店 GUI =)
The following code can be used to give the player the shop gui:
Note that "ShopPart" should be a big part that cover the whole shop area (preferable invisible)
Then you also have to build a shop gui.
In the shop gui you should make TextButtons (or image buttons) that each contains the following script:
The code ain't tested, so it might contain errors. And you might need to change more stuff than mentioned. But it should give you an idea on how to make the shop gui =)