如何在我的GUI中获取它?
2017-7-30 2:30:54
收藏:0
阅读:258
评论:1
感谢您查看我的问题,希望您能为我带来我所寻找的答案。我已经尝试了很多不同的方法。也许我只是忽略了它。我对GUI制作等是新手。提前感谢任何意见。
这是针对运行在Lua上的Roblox游戏的问题。
我的问题是... 好的,所以我想要这个基本文本按钮来关闭GUI。我搞不清楚它的用法,也许有人可以帮助我吗? 我以为我需要制作一个新的frame并将它放在我想要的位置,并将文本按钮放在它上面,但是不管怎样都没有用。我尝试了更多的方法,但没有一个能够工作。
-- 对象
local VanScreenGui = Instance.new("ScreenGui")
local OpenFrame = Instance.new("Frame")
local OpenTextButton = Instance.new("TextButton")
local VanGui = Instance.new("Frame")
local VanTextButton = Instance.new("TextButton")
local VanTextBox = Instance.new("TextBox")
local VanGuiCloser = Instance.new("TextButton")
local VanGuiCloserFrame = Instance.new("Frame")
-- 属性
VanScreenGui.Name = "VanScreenGui"
VanScreenGui.Parent = game.CoreGui
--
OpenFrame.Name = "OpenFrame"
OpenFrame.Parent = VanScreenGui
OpenFrame.BackgroundColor3 = Color3.new(1, 1, 1)
OpenFrame.Draggable = true
OpenFrame.Position = UDim2.new(0, 27, 0, 448)
OpenFrame.Size = UDim2.new(0, 76, 0, 29)
OpenFrame.Style = Enum.FrameStyle.DropShadow
OpenTextButton.Name = "Open.TextButton"
OpenTextButton.Parent = OpenFrame
OpenTextButton.BackgroundColor3 = Color3.new(1, 1, 1)
OpenTextButton.Position = UDim2.new(0, 6, 0, 0)
OpenTextButton.Size = UDim2.new(0, 50, 0, 15)
OpenTextButton.Style = Enum.ButtonStyle.RobloxRoundButton
OpenTextButton.Font = Enum.Font.SourceSans
OpenTextButton.FontSize = Enum.FontSize.Size14
OpenTextButton.Text = "打开"
OpenTextButton.TextSize = 14
VanGui.Name = "VanGui"
VanGui.Parent = VanScreenGui
VanGui.BackgroundColor3 = Color3.new(1, 1, 1)
VanGui.Draggable = true
VanGui.Position = UDim2.new(0, 33, 0, 343)
VanGui.Selectable = true
VanGui.Size = UDim2.new(0, 254, 0, 82)
VanGui.Style = Enum.FrameStyle.DropShadow
VanGui.Visible = false
VanTextButton.Name = "Van.TextButton"
VanTextButton.Parent = VanGui
VanTextButton.BackgroundColor3 = Color3.new(1, 1, 1)
VanTextButton.BackgroundTransparency = 0.5
VanTextButton.Position = UDim2.new(0, 30, 0, 41)
VanTextButton.Size = UDim2.new(0, 179, 0, 20)
VanTextButton.Font = Enum.Font.Arcade
VanTextButton.FontSize = Enum.FontSize.Size32
VanTextButton.Text = "运货车"
VanTextButton.TextSize = 30
VanTextBox.Name = "Van.TextBox"
VanTextBox.Parent = VanGui
VanTextBox.BackgroundColor3 = Color3.new(1, 1, 1)
VanTextBox.BackgroundTransparency = 0.5
VanTextBox.Position = UDim2.new(0, 32, 0, 0)
VanTextBox.Size = UDim2.new(0, 177, 0, 20)
VanTextBox.Font = Enum.Font.Arcade
VanTextBox.FontSize = Enum.FontSize.Size28
VanTextBox.Text = "名称"
VanTextBox.TextSize = 25
VanGuiCloser.Name = "VanGuiCloser"
VanGuiCloser.Parent = VanGui
--VanGuiCloser.Visable = true
VanGuiCloser.BackgroundColor3 = Color3.new(1, 1, 1)
VanGuiCloser.BackgroundTransparency = 0.5
VanGuiCloser.Position = UDim2.new(0, 255, 0, 354)
VanGuiCloser.Size = UDim2.new(0, 20, 0, 14)
VanGuiCloser.Font = Enum.Font.SourceSans
VanGuiCloser.FontSize = Enum.FontSize.Size14
VanGuiCloser.Text = "X"
VanGuiCloser.TextSize = 14
OpenTextButton.MouseButton1Down:connect(function()
game.CoreGui.VanScreenGui.VanGui.Visible = true
game.CoreGui.VanScreenGui.OpenFrame.Visible = false
end)
VanGuiCloser.MouseButton1Down:connect(function()
game.CoreGui.VanScreenGui.VanGui.Visible = false
game.CoreGui.VanScreenGui.OpenFrame.Visible = true
end)
点赞
评论区的留言会收到邮件通知哦~
推荐文章
- Lua 虚拟机加密load(string.dump(function)) 后执行失败问题如何解决
- 我想创建一个 Nginx 规则,禁止访问
- 如何将两个不同的lua文件合成一个 东西有点长 大佬请耐心看完 我是小白研究几天了都没搞定
- 如何在roblox studio中1:1导入真实世界的地形?
- 求解,lua_resume的第二次调用继续执行协程问题。
- 【上海普陀区】内向猫网络招募【Skynet游戏框架Lua后端程序员】
- SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
- Lua实现网站后台开发
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?

如果您想要摆脱“打开”按钮,只需使用:
:Destroy()示例
buttonname.MouseButton1Click:connect(function() game.CoreGui.openbuttonname:Destroy() end)如果这不是您想做的事,请更明确地说明,因为很难理解您在说什么。