Im Trying to invoke Remote Function to send tool information when i equip the tool. On breakpoints, tool enters to variable but on server side, player's information sended always
local script on weapon
local tool = script.Parent tool.Equipped:Connect(function() local weaponType = tool GetWeaponInformation:InvokeServer(weaponType) BindFireInput:Invoke() end)
Server side script:
function getWeaponInformation(weaponInformation) print(weaponInformation) return weaponInformation end GetWeaponInformation.OnServerInvoke = getWeaponInformation
First of all, if you aren’t expecting a return in the client, then use a RemotEvent
instead of a RemoteFunction
. However, the issue here is remote events and functions on the server get an extra argument, which is the Player object of the client who fired it. So instead of your function arguments being getWeaponInformation(weaponInformation)
, they need to be getWeaponInformation(plr, weaponInformation)
. Don’t add the extra player argument to be fired from the clientside, only expect it on the server.
Reply with further questions, And please mark as correct if this solution worked for you!
When calling a RemoteFunction or RemoteEvent, the first argument on the server is the player who called it. So all you have to do is take account for that and everything else should work.
function getWeaponInformation(player,weaponInformation)