Answered Plainly
Display: Text size:

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

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:

  1. In the Explorer, hover over ReplicatedStorage, click the โŠ• button, and insert a RemoteEvent.
  2. 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):

  1. Hover over StarterGui, click โŠ•, and insert a ScreenGui.
  2. Hover over the new ScreenGui, click โŠ•, and insert a TextButton.
  3. 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.

Sources (official only; read in full November 7, 2026):

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.