Hello
Please dont get angry cause of the dont knowing events, thank you.
I want to know whats remote event and the use of, cause i see how remote events are useful!
I hope i get a answer!
Thank you!
Hello
Please dont get angry cause of the dont knowing events, thank you.
I want to know whats remote event and the use of, cause i see how remote events are useful!
I hope i get a answer!
Thank you!
Hello!
RemoteEvents can be quite difficult to get an understanding of at the beginning, however, when you get to work with them more often, you tend to become more familiar with them and what they actually do. A very good post already posted in the ROBLOX Developer Articles explains in much detail what RemoteEvents do. You can check that out here.
So what are RemoteEvents?
Well, to put it in the most simple way, RemoteEvents are most commonly used to get the Client to communicate with the server, or the Server to communicate to the Client. Because sometimes we may require to access ServerSided storages like ServerStorage or ServerScriptStorage, and because ServerSided storages are locked to the Server Only, we are required to use RemoteEvents to access these things via the client.
There are also more uses you can put RemoteEvents to, like getting the Server to communicate with all the Clients ingame, and run multiple specific things at once, and all be recieved by the clients, and this can be done with the function RemoteEvent:FireAllClients() event, and the function between the brackets.
That is the basic explanation on how RemoteEvents function, and, to recap it all, RemoteEvents, in a nutshell, are pretty much a way for the Client or Server to communicate with each other!
Now that we have a basic understanding about RemoteEvents, we can put these into use!
I will start off with the Client communicating with the Server getting access to the server to print out something serversided.
Client-Sided RemoteEvent Script (LocalScript):
-- Example: Get the RemoteEvent to fire via a GUI Button
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("ExampleEvent") -- I'll keep this Example RemoteEvent stored into ReplicatedStorage
local Button = script.Parent
local UI = Button.Parent
Button.MouseButton1Click:Connect(function()
RemoteEvent:FireServer() -- Very simple usage of a RemoteEvent from the Client, FireServer is used to fire the remote event to communicate with the server.
end)
Server-Sided RemoteEvent Script (ServerScript):
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("ExampleEvent")
RemoteEvent.OnServerEvent:Connect(function() -- Runs when the RemoteEvent is fired from a client to the server
print("Remote Recieved! - Server") -- If recieved correctly, the server will respond with a print statement from the server!
end)
So, that was a basic description and answer to your question, about RemoteEvents, and I hope this has given you a better understanding about RemoteEvents! Do keep in mind that RemoteEvents can have much bigger uses, and can be used for alot more things and store alot of functions, what I have shown here were very basic examples of when to use a RemoteEvent, and why.
I hope this has helped you!
This discussion is preserved as it was. New answers, comments, and votes are closed.