Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

can someone explain this error with remote functions?

Asked by 1 year ago
Edited 1 year ago

i tried to invoke a remote function by typing this into a server script: "player.PlayerGui.ScreenGui.trade.tradeCarer.traderName:InvokeClient(player)" , and i wrote this in the right local script:
"script.traderName.OnClientInvoke:Connect(function()
return script.Parent.playerName.Text
end)"
but i got this error:
"OnClientInvoke is a callback member of RemoteFunction; you can only set the callback value, get is not available"
, does anyone know why?, i looked it up on google but i couldn't find anything

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

for remote functions you have to write functions instead of connecting events to functions, so your code should have been

function script.traderName.OnClientInvoke()
    return script.Parent.playerName.Text
end

other than that the code looks fine as far as I can tell

Ad

Answer this question