What They Are

Key Points


Creating a Remote Function

  1. Go to ReplicatedStorage.
  2. Insert → RemoteFunction.
  3. Give it a name, e.g., GetPlayerData.

Server Script Example

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GetPlayerData = ReplicatedStorage:WaitForChild("GetPlayerData")

-- Function to handle requests from the client
GetPlayerData.OnServerInvoke = function(player)
    return "Hello, " .. player.Name
end


Client Script Example

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GetPlayerData = ReplicatedStorage:WaitForChild("GetPlayerData")

-- Call the remote function
local result = GetPlayerData:InvokeServer()
print(result)  -- Output: Hello, PlayerName


Important Notes