Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

can someone explain this error with remote functions?

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

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.