I've never really understood when I should use remote events over remote functions or the other way around. I always use remote events and never have used remote functions, should I be using them for certain things?
When to use remote event or remote function?
2 answers
Let's say you use remote events when you want something to run in another script that's not on the same type of script as the one you fire it from.
You use a remote function when you need a value returned by the function, a practical example:
localscript:
local remfunction = game.ReplicatedStorage.RemoteFunction
print(remfunction:InvokeServer())
script:
local x = "potato"
local remfunction = game.ReplicatedStorage.RemoteFunction
local function returnpotato()
return x
end
remfunction.OnServerInvoke = returnpotato()
The local script in the above example would print "potato".
1 comment
If you don't understand, check this out: https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events#Client_to_Server
Please do a quick search in Google before asking your question:
https://gyazo.com/94ddf90fb2b72b9d81be34c8db660ab8
https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events
1 comment
Check out this link:https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
If you want a value returned then you'll want to use a remote function, otherwise just stick to events