lua - Roblox Lua 错误值不是 Player 的有效成员,但我不尝试访问它
问题描述
我正在尝试在 Roblox 上制作游戏,不久前我遇到了一个错误,我找不到修复并放弃了,我刚刚开始尝试再次修复它。当我尝试检查玩家是否有能力购买该物品时,我收到错误 Value is not a valid member of Player,这是我的代码来自错误的来源
game:GetService("ReplicatedStorage"):WaitForChild("Shop"):WaitForChild("UpgradeClicks").OnServerEvent:Connect(function(player, price)
if player.leaderstats.Views.Value <= price.Value then
print("test")
end
end)
这是按下按钮时发生的代码
local RE = game:GetService("ReplicatedStorage").Shop.UpgradeClicks
local button = script.Parent
local price = script.Parent.Price
local player = game.Players.LocalPlayer
button.MouseButton1Click:Connect(function()
RE:FireServer(player, price)
end)
解决方案
尝试在不输入播放器变量的情况下调用 fireserver。
推荐阅读
- kubernetes - `kubectl auth can-i` 的 Kubernetes API 模拟是什么
- android - Android:如何将初始屏幕背景图像适合全屏
- saxon - 如何使用 Saxon API 从模式感知 xslt 获取警告
- javascript - BIRT 根据其他数据集中的值隐藏行
- svn - svn:符号查找错误:/lib64/libldap_r-2.4.so.2:未定义符号:redhat 上的 ber_sockbuf_io_udp
- flutter - 颤动的gridview分页失败
- fluentd - 通过fluentD限制相同日志的数量
- apache-poi - 从 3.1.0 升级到 4.0.0 会为 org.apache.xmlbeans.XmlOptions.put(Ljava/lang/Object;) 抛出 NoSuchMethod
- android - 在 API Q+ 上,EditText 的自定义光标可绘制被忽略
- airflow - 如何将 xcom 作为 PostgresOperator 参数?