键绑定读取器脚本
好的,所以我制作了一个按键绑定脚本,它将 IntValue 设置为您按下的按键的字节码。这一切都很好。 问题是读取按键绑定部分的脚本不起作用。 这是脚本:
print("Running KeyCheck script")
KeyValue = script.Parent.KeyValue
function onChanged(Value)
print("Changed: " .. Value)
end
KeyValue.Changed:connect(onChanged)
它位于播放器的本地脚本中。 KeyValue就是我前面提到的IntValue。 我没有收到任何错误,但没有打印得很好,打印任何东西。
Ok, so I made a Key Bind script, that sets a IntValue to the byte code of a Key you press. That works all fine.
The problem is that the script that reads the Key Bind part doesn't work.
Here is the script:
print("Running KeyCheck script")
KeyValue = script.Parent.KeyValue
function onChanged(Value)
print("Changed: " .. Value)
end
KeyValue.Changed:connect(onChanged)
It's in a Local Script, in the player. KeyValue is the IntValue I mentioned earlier.
I don't get any errors, but none of the prints well, print anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
出色地,
只要
script.Parent.KeyValue
存在,它就应该可以工作。您可能想知道的一件事是,当任何类型的“Value”对象发生更改时,它都会返回值,而不是更改了哪个属性。
我想你可能已经知道了。
您可以尝试用常规脚本来实现。
Well,
As long as
script.Parent.KeyValue
exists, it should work.One thing you might wanna know is when any type of "Value" object is changed, it returns the value, not which property was changed.
I think you might already know that.
You might try it in a regular script.
好的,明白了。只需将 KeyBind 脚本设置为非本地即可。德普。
Ok, got it. Just had to set the KeyBind script to not local. Derp.