lua - 为什么我无法从本地脚本向服务器脚本发送已配备工具的信息?
问题描述
我在装备工具时尝试调用远程功能来发送工具信息。在断点处,工具进入变量,但在服务器端,总是发送玩家的信息
武器上的本地脚本:
tool.Equipped:Connect(function()
local weaponType = tool
GetWeaponInformation:InvokeServer(weaponType)
BindFireInput:Invoke()
end)
服务器脚本:
function getWeaponInformation(weaponInformation)
print(weaponInformation)
return weaponInformation
end
GetWeaponInformation.OnServerInvoke = getWeaponInformation
解决方案
function getWeaponInformation(player, weaponInformation) --changes made here
print(weaponInformation)
return weaponInformation
end
GetWeaponInformation.OnServerInvoke = getWeaponInformation
第一个参数始终是玩家。
推荐阅读
- python - 如何在数据集中找到重复的名称并将它们放在单独的列中?
- c++ - unordered_map:试图引用已删除的函数
- node.js - Netlify Page Not Found 错误(无法将 serverless express 后端部署到 NETLIFY)
- python - Python: Pandas - 嵌套循环需要很长时间才能完成。如何加快速度?
- c# - Xamarin iOS new StackTrace() 杀死应用程序:未满足断言条件“klass”
- css - 如何在父类或 id 中设置 A 元素的样式
- javascript - 使用 Vue 在 p 标签内渲染 HTML
- webhooks - 在 IFTTT 中发送和接收事件/通知
- python - 在 Windows 终端 Python 中打印表情符号
- c# - 如何编写将 DBNull 值转换为 Nullable 的通用方法?