I am wondering what the difference is between invoke server and fire server? I’ve read the roblox docs and as far as I know it’s basically the same? Also, when should I use Invoke Server instead of FireServer
Thanks
I am wondering what the difference is between invoke server and fire server? I’ve read the roblox docs and as far as I know it’s basically the same? Also, when should I use Invoke Server instead of FireServer
Thanks
Invoke server is only used for remote functions. Fire server is only used for remote events.
But it’s basically the same right, both from client to server
The difference between the two is the response.
RemoteEvent will only send a request, but it will not expect a response from the receiver.
RemoteFunction will send a request and is expected a response from the receiver.
InvokeServer
yields until a value is returned by the server
-- client
local result = Event:FireServer(13) -- doesn't yield
print(result) -- nil, RemoteEvents don't wait for a value to be returned
-- server
Event.OnServerEvent:Connect(function(plr, num)
wait(num)
return -- Wouldn't return anything to the client
end)
-- client
local result = Function:InvokeServer(9) -- would yield (pause the script) for 9 seconds
print(result) -- 'Done!'
-- server
Function.OnServerInvoke = function(player, num)
wait(num)
return 'Done!'
end
I would suggest looking at this
The short of it should be: