Syntax
remote:FireServer("help")
-- Server listener receives (player, "help")Examples
Validate a small request on the server
Create a RemoteEvent named LessonHelp in ReplicatedStorage. Put this Script in ServerScriptService. Only the literal help action is accepted, and each player can receive one reply per second.
local Players = game:GetService("Players")
local remote = game:GetService("ReplicatedStorage"):WaitForChild("LessonHelp")
local lastRequest = {}
remote.OnServerEvent:Connect(function(player, action)
if typeof(action) ~= "string" or action ~= "help" then return end
local now = os.clock()
if now - (lastRequest[player] or -math.huge) < 1 then return end
lastRequest[player] = now
remote:FireClient(player, "Open the lesson panel to continue.")
end)
Players.PlayerRemoving:Connect(function(player)
lastRequest[player] = nil
end)Listen before sending
LocalScript in StarterPlayerScripts, paired with the RemoteEvent and server script above. Connect before FireServer so a quick reply has a listener. FireAllClients belongs on the server and should carry server-chosen messages.
local remote = game:GetService("ReplicatedStorage"):WaitForChild("LessonHelp")
remote.OnClientEvent:Connect(function(message)
print(message)
end)
remote:FireServer("help")Best practices
- Never accept a client-supplied Player or reward amount as authority; OnServerEvent already identifies the sender.
- Validate argument types, allowed values and game state before making changes.
- Use per-player limits and remove their entries on departure; a single global debounce unfairly blocks other players.
Runtime & versions
Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
Luau documentation