lua - TextButton not opening Frame
问题描述
So I have a simple text button inside of a ScreenGui with the following lua code.
local Button = script.Parent
local Frame = script.Parent.Parent.Frame
function onClick()
if Frame.Visible == false then
Frame.Visible = true
elseif Frame.Visible == true then
Frame.Visible = false
end
end
Button.MouseButton1Click:Connect(onClick)
However, when I click on the button, the frame does not show up.
The frame is set to not be visible by default.
The button is set to active, visible and selectable.
解决方案
尝试使用干净的脚本将其更改Frame
为可见。检查您的语法是否正确。IE:
local Frame = script.Parent.Parent.Frame
Frame.Visible = true
如果它仍然不起作用,请尝试删除elseif
. elseif
在不喜欢该命令之前,我遇到了脚本问题。你可以放else
,它会做完全相同的工作。
推荐阅读
- sql - 在 toad 中一次执行多个选择查询
- javascript - 在 setState() 中重新设置整个状态
- node.js - 从 angular2 中的 API 响应中解压缩或解压缩数据
- excel - MS Excel 收到 ORA-12560 协议适配器错误(SQLSetConnectAttr 失败)
- node.js - 在nodejs中查询leveldb数据库中的值
- python - 是否可以在不刷新其内容的情况下关闭 memmap 的临时文件?
- javascript - 使用 onClick 无休止地重新渲染 React 组件
- google-bigquery - BigQuery 代码段中的错误
- python - 将函数/计算应用于熊猫中的多个列
- python - Dask中掩码函数的正则表达式