– How to use remote functions roblox
RemoteFunctions are used to send messages between the client and the server, but unlike RemoteEvents, they send a response back.
They are mostly used for the client to get some information form the server like a players data, an item price, or a calculation.
The difference between RemoteEvents and RemoteFunctions
- RemoteEvents sends data and thats it.
- RemoteFunctions also sends data, but they get a response back.
RemoteFunctions should be stored in a place both the client and server can access – like ReplicatedStorage.
Excample
Lets say we wanted the client to see if they had enough Coins to buy a tool. Then we could do something like this:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local getCoins = ReplicatedStorage:WaitForChild("YourRemoteFunction")
local coins = getCoins:InvokeServer()
print(coins)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local getCoins = ReplicatedStorage:WaitForChild("YourRemoteFunction")
getCoins.OnServerInvoke = function(player)
-- Lets return a fake amount for now
return 42
end
This will then print 42 on the client.
Note on Performance
Unlike RemoteEvents, InvokeServer() waits for a response. Don’t use it in high-speed loops or where lag could hurt the experience. Always assume it might take some time to respond.

