The Player Talks to the Server: RemoteEvents
The short answer: Your game runs in two places at once. The server โ a computer run by Roblox โ holds the one true version of the game and keeps every player in sync. Each player's device, the client, holds a copy it can see and touch. The two sides cannot just reach into each other, so they send messages: a RemoteEvent is a one-way message, and a RemoteFunction is a message that waits for an answer. And one rule rules them all: the server checks everything.
Why there is a wall
The Creator Documentation describes the split plainly: the server is the ultimate authority for the game's state, and it constantly sends updates โ a process called replication โ so every client's copy matches. A player's device can change its own copy all it likes, but those changes do not become real for the game or for anyone else. Creators call this wall FilteringEnabled.
Why so strict? Because the client is the player's own machine, and a determined cheater has complete control over it. Roblox's security guide lists what that control includes: a cheater can fire your RemoteEvents as often as they want, with any arguments they want. If your server believed the client, a cheater could simply tell your game they have a million coins โ and the game would agree. So the client is allowed to ask, and the server decides.
The two messengers
- RemoteEvent โ one-way. The sender fires it and moves on; it does not wait for a reply. Client to server:
FireServer(). Server to one player:FireClient(player). Server to everybody:FireAllClients(). - RemoteFunction โ two-way. The sender waits until the other side answers. The client calls
InvokeServer(); the server setsOnServerInvoketo a function that returns the answer. - Both live where both sides can see them โ the standard home is ReplicatedStorage.
One caution from the remote guide: a server asking a client through a RemoteFunction (InvokeClient) is risky โ if the client errors, disconnects, or simply never answers, the server can be left waiting forever. For server-to-client messages that do not truly need an answer, the guide steers you to a plain RemoteEvent.
Build it: click a button, earn a coin
Setup โ the messenger:
- In the Explorer, hover over ReplicatedStorage, click the โ button, and insert a RemoteEvent.
- Rename it CoinClick โ name remotes for what they are for; future-you will thank you.
Setup โ the button (from the Creator Documentation's buttons guide):
- Hover over StarterGui, click โ, and insert a ScreenGui.
- Hover over the new ScreenGui, click โ, and insert a TextButton.
- Select the TextButton and set its Text property to Earn a coin.
Setup โ the score: add page 6's Leaderboard script to ServerScriptService, but rename its stat from Points to Coins (change the IntValue's name where the script sets it). The server script below looks for a stat called Coins.
The client half. Put a LocalScript inside the TextButton and give it this code. All it does is announce a click โ it carries no amount, no score, nothing worth stealing:
-- Put this LocalScript inside the TextButton.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coinEvent = ReplicatedStorage:WaitForChild("CoinClick")
local button = script.Parent
local function onButtonActivated()
coinEvent:FireServer()
end
button.Activated:Connect(onButtonActivated)The server half. Put a Script named CoinServer in ServerScriptService:
-- Put this Script in ServerScriptService. Name it CoinServer.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coinEvent = ReplicatedStorage:WaitForChild("CoinClick")
local function onCoinClicked(player)
local leaderstats = player:WaitForChild("leaderstats")
local coins = leaderstats:WaitForChild("Coins")
coins.Value += 1
print(player.Name .. " earned a coin. Total: " .. coins.Value)
end
coinEvent.OnServerEvent:Connect(onCoinClicked)What you should see: run the game and click the button. Each click raises your Coins score by exactly 1, and Output prints lines like Alex earned a coin. Total: 3. Two details do all the work. First, on the server the player is always the first thing the event hands your function โ Roblox fills that in itself, so the server always knows who is really asking. Second, the amount โ one coin โ is written in the server script, where no player can touch it.
THE GOLDEN RULE: NEVER TRUST THE PLAYER. THE SERVER CHECKS EVERYTHING.
This is not just this page's opinion โ "never trust the client" is the first principle in Roblox's own security guide. Here is the trap it protects you from. A beginner's first instinct is to let the button say how much it is worth:
-- THE WRONG WAY โ shown so you can recognize it, never to use it:
-- If the client sends the amount and the server just adds it,
-- a cheater can fire this themselves with any number they like:
-- coinEvent:FireServer(1000000)Our design sends no amount at all. The click says "I clicked," the server adds its own fixed 1, and a cheater firing the event a thousand times has only asked a thousand times โ which is where page 5's cooldowns come back: Roblox's security guide says any action a client can trigger needs a server-side rate limit, because client-side limits can be bypassed by the same cheaters they are meant to stop. Ask on the client. Decide on the server. Limit on the server.
This page is part of the Roblox Luau series:
1. Installing Roblox Studio ยท
2. Your First Script ยท
3. Luau Basics 1: Variables, Numbers, and Words ยท
4. Luau Basics 2: Choices, Loops, and Functions ยท
5. Making Things Happen: Events ยท
6. Saving a Player's Progress ยท
7. The Player Talks to the Server ยท
8. Build a Whole Mini-Game ยท
9. Stay Safe and Keep Your Game Yours
Sources (official only; read in full November 7, 2026):
- Roblox Creator Documentation, Client-server runtime (create.roblox.com/docs) โ the server is the ultimate authority for the game's state and keeps all clients in sync; clients receive a copy of the game; replication keeps the copies matching.
- Roblox Creator Documentation, Remote events and functions โ RemoteEvent is one-way (FireServer, FireClient, FireAllClients; the sender does not wait) and RemoteFunction is two-way (InvokeServer; the server sets OnServerInvoke); remotes live where both sides can see them, such as ReplicatedStorage, created through the Explorer and renamed for their purpose; on the server, the player is always the first argument; the risks of InvokeClient, including a server left waiting forever, and the guidance to use RemoteEvent for server-to-client messages that do not need an answer.
- Roblox Creator Documentation, Security and cheat mitigation tactics โ the foundational principle "never trust the client"; an exploiter can fire RemoteEvents and RemoteFunctions at any frequency with arbitrary arguments; all critical logic must be validated or run on the server; the server is the source of truth for progression and rewards.
- Roblox Creator Documentation, Securing the client-server boundary โ every piece of data from a client must be validated by the server; rate limiting for client-triggered actions, enforced on the server, never relying on client-side limits alone.
- Roblox Creator Documentation, Text & image buttons โ adding a ScreenGui and TextButton through StarterGui; scripting a button by connecting a LocalScript to its Activated event.
The clicker scripts' logic was run on this machine against a small fake Roblox setup before this page was written: two simulated button clicks traveled through the RemoteEvent to the server half and raised the coin count to exactly 2, as this page describes. The scripts were also checked line by line against the documentation above. Checked November 7, 2026.