Creator Guide
English
English
  • OVERDARE
    • 🚩Introduction to OVERDARE
    • 🐤Get Started
      • OVERDARE App
      • OVERDARE Studio
    • 📌Policy
      • Community Guidelines
      • UGC Creation Guidelines
      • Guidelines on the External Use of UGC
      • Logo Usage Guidelines
      • Intellectual Property Rights Policy
      • Reporting Guidelines
      • Guidelines on Disputing Suspensions and Bans
      • Creator Payout Policy
      • Monetization Guidelines
    • 🅰️OVERDARE Glossary
  • MANUAL
    • 🏰Studio Manual
      • Get Started
        • Studio Interface
        • World Template
        • Coordinate System
        • Studio Test Play
        • World Publish
        • Collaboration
      • Asset & Resource Creation
        • Asset Import
        • Animation Editor
      • Game Development
        • Game Settings
        • Script Editor
        • Align Tool
        • Material Manager
        • Collision Groups
        • Tag Editor
        • Performance Guide
      • Object
        • Part
        • Model
        • Camera
        • Physics
        • Lighting
        • Tool
        • VFX
        • Sound
      • Character
        • Character Animation
        • Humanoid Description
      • GUI
    • 📝Script Manual
      • Get Started
        • Script Overview
        • Basic Guide to Lua
        • Coding Style
        • Object Reference
        • Unity Developer Guide
      • Events & Communication
        • Event
        • Server-Client Communication
        • BindableEvent
        • Value Objects
      • Input & Controls
        • Mobile Input Handling
        • TPS Strafing System
      • Advanced Gameplay Systems
        • Saving & Loading Data
        • Tween
        • Module Script
      • Debugging & Optimization
        • Breakpoint
        • Practical Guide to Script Optimization
  • 💸Monetization
    • Payout Guideline
  • DEVELOPMENT
    • 📚API Reference
      • Enums
        • ActuatorRelativeTo
        • AnimationPriority
        • AspectType
        • AssetTypeVerification
        • BorderMode
        • CameraMode
        • CameraType
        • ContextActionResult
        • CoreGuiType
        • DominantAxis
        • EasingDirection
        • EasingStyle
        • ForceLimitMode
        • HttpCompression
        • HttpContentType
        • HumanoidDisplayDistanceType
        • HumanoidStateType
        • KeyCode
        • Material
        • MaterialPattern
        • NormalId
        • ParticleEmitterShape
        • ParticleEmitterShapeInOut
        • ParticleEmitterShapeStyle
        • ParticleFlipbookLayout
        • ParticleFlipbookMode
        • ParticleOrientation
        • PartType
        • PlaybackState
        • RaycastFilterType
        • RollOffMode
        • RotationType
        • UserInputState
        • UserInputType
        • VelocityConstraintMode
      • DataTypes
        • BlendSpaceSampleSata
        • BrickColor
        • CFrame
        • Color3
        • ColorSequence
        • ColorSequenceKeypoint
        • Content
        • Enum
        • EnumItem
        • NumberRange
        • NumberSequence
        • NumberSequenceKeypoint
        • OverlapParams
        • PhysicalProperties
        • Ray
        • RaycastParams
        • RaycastResult
        • ScriptConnection
        • ScriptSignal
        • TweenInfo
        • Udim
        • Udim2
        • Vector2
        • Vector3
      • Classes
        • Animation
        • AngularVelocity
        • AnimationTrack
        • Animator
        • Atmosphere
        • Attachment
        • Backpack
        • BackpackItem
        • BasePart
        • BaseScript
        • Beam
        • BindableEvent
        • BlendSpace
        • BoolValue
        • Bone
        • Camera
        • CharacterMesh
        • CollectionService
        • Constraint
        • ContextActionService
        • CoreGui
        • DataStore
        • DataModel
        • DataStoreGetOptions
        • DataStoreIncrementOptions
        • DataStoreInfo
        • DataStoreKeyPages
        • DataStoreKeyInfo
        • DataStoreService
        • DataStoreListingPages
        • DataStoreSetOptions
        • FormFactorPart
        • Frame
        • Folder
        • GlobalDataStore
        • GuiBase2d
        • GuiButton
        • GuiObject
        • HttpService
        • Humanoid
        • HumanoidDescription
        • ImageButton
        • ImageLabel
        • InputObject
        • IntValue
        • LayerCollector
        • Instance
        • Light
        • Lighting
        • LinearVelocity
        • LocalScript
        • LuaSourceContainer
        • MaterialService
        • MaterialVariant
        • MeshPart
        • Model
        • ModuleScript
        • Mouse
        • OrderedDataStore
        • Pages
        • Part
        • ParticleEmitter
        • PhysicsService
        • Player
        • PlayerGui
        • Players
        • PlayerScripts
        • PointLight
        • PVInstance
        • ReplicatedStorage
        • RemoteEvent
        • ScreenGui
        • RunService
        • Script
        • ServerStorage
        • ServiceProvider
        • Skeleton
        • ServerScriptService
        • Sound
        • SoundService
        • SoundGroup
        • SpotLight
        • SpawnLocation
        • StarterCharacterScripts
        • StarterPack
        • StarterGui
        • StarterPlayer
        • StarterPlayerScripts
        • StringValue
        • SurfaceGui
        • SurfaceGuiBase
        • Team
        • Teams
        • TextLabel
        • TextButton
        • Tool
        • Trail
        • Tween
        • TweenService
        • TweenBase
        • UIAspectRatioConstraint
        • UserGameSettings
        • UserInputService
        • UserSettings
        • VectorForce
        • Workspace
        • WrapLayer
        • WorldRoot
        • WrapTarget
  • UPDATE
    • 📰Release Note
Powered by GitBook
On this page
  • Overview
  • Types of Communication
  • RemoteEvent Object
  • Communication Using RemoteEvent
  • FireAllClients (Server ➡ All Client)
  • FireClient (Server ➡ Specific Client)
  • FireServer (Client ➡ Server)
  • Advanced Usage
  1. MANUAL
  2. Script Manual
  3. Events & Communication

Server-Client Communication

PreviousEventNextBindableEvent

Last updated 2 months ago

Overview

OVERDARE’s world operates based on communication between the server and the client.

  • The server manages the global state of the game and acts as the central system that handles communication with all clients (players).

  • The client is a local environment that runs on an individual player’s device, handling player input, visual effects, UI, and more.

Since the server and client operate independently, in a multiplayer game, game logic, camera control, and player input handling must be implemented and communicated using RemoteEvent.

Types of Communication

Since the server and client have different functionalities, communication between them requires the use of RemoteEvent.

For example, GUI elements like buttons are processed only on the client-side, while game logic must be handled on the server-side. In other words, when a skill button click occurs on the client, it needs to send an event to the server to request that the server processes the skill usage logic.

RemoteEvent connects the roles of the server and client, enabling core interactions in multiplayer games.

Communication Type
Sender
Receiver
Example

Event sent from the sever to all clients

Server

Client

Game Over

Event sent from the server to a specific client

Server

Client

Display level-up UI on level-up

Event sent from the client to the server

Client

Server

Skill button click

RemoteEvent Object

RemoteEvent is an object provided to handle events between the server and client, supporting one-way communication.

For communication between the server and client, the RemoteEvent object must be accessible from both sides. To achieve this, RemoteEvent is placed in ReplicatedStorage, a storage where the server and client can share data. ReplicatedStorage safely synchronizes objects between the server and client, ensuring that the RemoteEvent is accessible in both environments.

Communication Using RemoteEvent

You can send arguments along with events when firing a RemoteEvent. The arguments are passed when calling the FireServer, FireClient, or FireAllClients methods, and the receiving side can receive the data in a callback function.

FireAllClients (Server ➡ All Client)

The server sends an event to all clients. This is useful for synchronizing global game states or delivering the same information to all players.

In Script

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage") 
local S2C_GameEnd = ReplicatedStorage:WaitForChild("S2C_GameEnd")

local function TimeOver()
    local isWin = false
    S2C_GameEnd:FireAllClients(isWin) -- Passing arguments
end

In LocalScript

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage") 
local S2C_GameEnd = ReplicatedStorage:WaitForChild("S2C_GameEnd")

local function OnGameEnd(isWin)
    print("[OnGameEnd] ", Players.LocalPlayer.Name, " / isWin : ", isWin)
end
S2C_GameEnd.OnClientEvent:Connect(OnGameEnd)

FireClient (Server ➡ Specific Client)

This method sends an event from the server to a specific client. It is used when handling tasks related to an individual player.

In Script

local Players = game:GetService("Players")

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

local function LevelUp(player)
    local prevLevel = 1
    local curLevel = 2
    S2C_LevelUp:FireClient(player, prevLevel, curLevel) -- Passing arguments
end

In LocalScript

local Players = game:GetService("Players")

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

local function OnLevelUp(prevLevel, curLevel)
    print("[OnLevelUp] ", Players.LocalPlayer.Name, " / LevelUp : ", prevLevel, " -> ", curLevel)
end
S2C_LevelUp.OnClientEvent:Connect(OnLevelUp)

FireServer (Client ➡ Server)

This method sends an event from the client to the server. It is used when the server needs to handle the user’s input or specific events (e.g., button clicks, skill use requests).

In LocalScript

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

local function ClickSkillButton()
    local skillID = 1
    C2S_UseSkill:FireServer(skillID)
end

In Script

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

local function OnUseSkill(player, skillID)
    print("[OnUseSkill] ", player.Name, " / skillID : ", skillID)
end
C2S_UseSkill.OnServerEvent:Connect(OnUseSkill)

Advanced Usage

  • Since data sent from the client cannot be trusted, it should always be validated by the server.

  • Send only the necessary information to the server to reduce network load. (Send only minimal data from the client)

  • Avoid creating too many RemoteEvents. If tasks can be handled in the same context, process them using a single RemoteEvent.

  • Create RemoteEvent connections only when necessary, and disconnect when finished to avoid memory leaks. (Disconnect() function)

  • When using a single RemoteEvent to handle multiple tasks, add the first argument (EventType) to indicate the task type. (Example of using EventType: PlayerActionType and ActionID)

💡 Tip. To clearly distinguish whether the RemoteEvent is for communication from the server to the client (Server to Client) or from the client to the server (Client to Server), it is recommended to use prefixes such as S2C_ for server-to-client communication and C2S_ for client-to-server communication. This makes the event’s role intuitive, enhancing code readability and maintainability.

📝