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

RemoteFunctions and how to use them?

I am familiar with RemoteEvents and had success with them. However, I am stuck on RemoteFunctions. How do I know when to use them? How do you use them?

1 comment

0

The only major difference is that the remote function will be awaiting a reply...basically you should always use a remote event unless you intend to have some 2 way communication

1 answer

✓ Accepted answer

To use remote functions, all you need to know is the event that fires the function, and the way to fire them.

A remote function is an instance that allows you to transfer requests through server, or client.

Below is an example of how you would call the remote function.

local remotefunction= game.ReplicatedStorage.RemoteFunctionName
remotefunction:InvokeServer(arguments)

When requesting the function to be passed through the server, you must be using a LocalScript, and when requesting the function to be passed through the client, you must be using a Script.

Below is an example of how the function would work;

local remotefunction= game.ReplicatedStorage.RemoteFunctionName

remotefunction.OnServerInvoke = function(arguments)
	print("Cheese")
end

When you call the function through the server, it will print cheese.

The reason these functions are very important on roblox, is because they allow you to transfer data through Filtering Enabled.

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