【问题标题】:Roblox Studio Printing Wrong ValueRoblox Studio 打印错误值
【发布时间】:2019-11-22 06:01:19
【问题描述】:

我正在 Roblox Studio 上编写一段代码,以根据 LightStaus.Value 的值更改某些属性。下面的代码是我目前所拥有的,但是它不能正常工作。

while true do
    if script.Parent.Parent.LightStatus.Value == 1 then
        script.Parent.Material = "Neon"
        script.Parent.PointLight.Enabled = true
        script.Parent.SpotLight.Enabled = true
    else
        script.Parent.Material = "SmoothPlastic"
        script.Parent.PointLight.Enabled = false
        script.Parent.SpotLight.Enabled = false
    end
    print(script.Parent.Parent.LightStatus.Value)
    wait(1)
end

我的代码应该打印LightStatus.Value 的值,但它没有这样做,如下图所示。即使值为 1,它也会打印 0。感谢任何帮助。


打印 0:


值设置为 0:

【问题讨论】:

  • 顺便说一句,脚本是普通脚本。我应该尝试本地脚本吗?
  • 您还有其他修改 LightStatus 值的脚本吗?

标签: lua roblox


【解决方案1】:

我发现了故障! 我在本地更改了LightStatus.Value 的值,所以它没有在客户端更新,这就是为什么它看起来被设置为true,但它说它被设置为false。您可以阅读有关客户端/服务器的更多信息here

【讨论】:

    猜你喜欢
    • 2022-11-23
    • 2018-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多