键绑定读取器脚本

发布于 2024-11-29 21:04:17 字数 350 浏览 0 评论 0原文

好的,所以我制作了一个按键绑定脚本,它将 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技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

地狱即天堂 2024-12-06 21:04:17

出色地,
只要 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.

ゃ人海孤独症 2024-12-06 21:04:17

好的,明白了。只需将 KeyBind 脚本设置为非本地即可。德普。

Ok, got it. Just had to set the KeyBind script to not local. Derp.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文