首页 > 解决方案 > 为什么我无法从本地脚本向服务器脚本发送已配备工具的信息?

问题描述

我在装备工具时尝试调用远程功能来发送工具信息。在断点处,工具进入变量,但在服务器端,总是发送玩家的信息

武器上的本地脚本:

tool.Equipped:Connect(function()

    local weaponType = tool

    GetWeaponInformation:InvokeServer(weaponType)
    BindFireInput:Invoke()

end)

服务器脚本:

function getWeaponInformation(weaponInformation)
    print(weaponInformation)
    return  weaponInformation

end

GetWeaponInformation.OnServerInvoke = getWeaponInformation

标签: luaroblox

解决方案


function getWeaponInformation(player, weaponInformation) --changes made here
    print(weaponInformation)
    return  weaponInformation
end

GetWeaponInformation.OnServerInvoke = getWeaponInformation

第一个参数始终是玩家。


推荐阅读