Roblox Studio中文标题:文本值没有改变,Lua语言
2020-6-26 8:1:32
收藏:0
阅读:158
评论:1
我的新游戏《Opix Islands》中的交付系统令我苦苦挣扎,我相信是这个脚本导致了问题。我认为值已经正确改变了,但我不能百分之百确定。我认为问题在于文本的更改。我已经确认在GUI移动之前,文本应被更改。感谢任何帮助。
此外,我在Roblox开发者论坛上进行了研究,以检查它是否为随机功能,并且我不认为它有错。我也没有看到任何错误,但屏幕上的文本绝对没有改变。
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
script.Parent.Parent.Script.BoxPresent.Value = false
local value = math.random(1,6)
wait()
local text = script.BoxUi.TextLabel.Text
if value == 0 then
text = "将包裹发送到:Opix推送中心"
elseif value == 1 then
text = "将包裹发送到:1市场街,Opix"
elseif value == 2 then
text = "将包裹发送到:2市场街,Opix"
elseif value == 3 then
text = "将包裹发送到:3市场街,Opix"
elseif value == 4 then
text = "将包裹发送到:4市场街,Opix"
elseif value == 5 then
text = "将包裹发送到:5市场街,Opix"
elseif value == 6 then
text = "将包裹发送到:6市场街,Opix"
end
print ("目的地设置完成。")
script.BoxUi.Value.Value = value
local gui = script.BoxUi:Clone()
gui.Parent = plr.PlayerGui
local box = script.Parent
box.Parent = plr.Backpack
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 代码?

text = "Deliver the Package to: Delivery Depot, Opix"
script.BoxUi.TextLabel.Text = "Deliver the Package to: Delivery Depot, Opix"
local text = "Deliver the Package to: Delivery Depot, Opix" script.BoxUi.TextLabel.Text = text
local value = math.random(1,6) local text if value == 0 then text = "Deliver the Package to: Delivery Depot, Opix" elseif value == 1 then text = "Deliver the Package to: 1 Market Street, Opix" elseif value == 2 then text = "Deliver the Package to: 2 Market Street, Opix" elseif value == 3 then text = "Deliver the Package to: 3 Market Street, Opix" elseif value == 4 then text = "Deliver the Package to: 4 Market Street, Opix" elseif value == 5 then text = "Deliver the Package to: 5 Market Street, Opix" elseif value == 6 then text = "Deliver the Package to: 6 Market Street, Opix" end
local text = "Deliver the Package to: " .. value .. " Market Street, Opix"
local text = string.format("Deliver the Package to: %d Market Street, Opix", value)
```
不需要那么多
if/elsif语句同时注意,
math.random(1,6)不会生成 0,因此你的 0-case 是不需要的。