Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

When to use remote event or remote function?

Asked by
trecept 367 Moderation Voter
5 years ago

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?

0
If you want a value returned then you'll want to use a remote function, otherwise just stick to events Vulkarin 581 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago

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".

Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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

0
Check out this link:https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events ew_girl21 2 — 5y

Answer this question