You can give examples of a remote event system (Server -> client)

Although I realized how to use remote events (Client → Server), I still didn’t understand how to use remote events (Server → Client) even though I saw the software wiki. Could someone give an example explaining each part?

1 Like

So, In my game Timed Obby, you click a button in workspace and it starts the timer with a gui in the client.

Its good for when someone touched or clicks a part, for example a shop, a gui will appear

1 Like

Teleport is what i use it for, and debug stuff a long with a ping measure

1 Like

In the game I’m working on, I have multiple RemoteEvents for communication outside of scripts.

For example, for a game I might want to change the player’s Camera Position, to make the game a bit more interesting. I set up a RemotEvent and using a Server Script and a LocalScript, I call the RemoteEvent from the Server Script, I call the LocalScript which can then use that information to change the player’s Camera Position to where I want it.

In another game, I have a tool to fire off objects to make a sort of shooting game. In a LocalScript I get all the information needed to create the object and then I use a RemoteEvent to send all of that information off to a Server Script so that it can be created on the server’s end.

1 Like

Its really similar

/--Client to Server--\

--Local Script
local RE = game:GetService("ReplicatedStorage")
local Event = RE.TestEvent

local Text = "Hey Jake"
Event:FireServer(Text)
--Server Script
local RE = game:GetService("ReplicatedStorage")
local Event = RE.TestEvent

Event.OnServerEvent:Connect(function(plr, Text)
     print(Text)--Hey Jake
end)

/--Server to Client--\

--Server Script
local RE = game:GetService("ReplicatedStorage")
local Event = RE.TestEvent

local Text = "Heya Steve"
Event:FireClient(plr, Text)--plr param fires to the player meaning it doesn't just have to be your player
--Local Script
local RE = game:GetService("ReplicatedStorage")
local Event = RE.TestEvent

Event.OnClientEvent:Connect(function(Text)--Text is the text you sent over when doing OnClientEvent you don't need to put the player param because you can get it through the local script
     print(Text)--Heya Steve
end)
2 Likes

I thank all users who helped to understand this, in my opinion all the answers served

1 Like