Jump to content
Sign in to follow this  
SimplifiedCode

Understanding RemoteEvents

Recommended Posts

Hello! I realized that remote events are hard for some people, and I wanted to clear the air that remote events are pretty easy!

What are remote events? Games with Filtering Enabled, don't have access to a lot of things on the client side, so we have to use remote events to tell the server when to do something, like change a name of a text button!

If you want more information, try checking out ROBLOX's article here

First, let's create a remote event in replicated storage: 

1.PNG.9031cdd04f3a9c7f4149738bbc219347.PNG

Now, let's create a local script, and put it in StarterGui:

2.PNG.73ba01f0db7ae6ebc928e0fb484b19d4.PNG

In this script, you would usually put things before it, like loading client information, but we will keep it simple.

print("OurEvent is about to fire!")
game.ReplicatedStorage.OurEvent:FireServer()
print("OurEvent has has fired!")

What this does is when we say "game.ReplicatedStorage.OurEvent:FireServer()" we say "Hey, we would like our RemoteEvent to run that's in replicated storage."

Let's create another script, but this time, a regular script in ServerScriptService:

3.PNG.31e019c69bdaf9bcf65039cf34b01f9b.PNG

Now, in this script, ask the server to tell us when we fired our event.

game.ReplicatedStorage.OurEvent.OnServerEvent:connect(function()
-- put code to do after the event has fired
end)

I hope this improved your knowledge on RemoteEvents, these are the very basics, but I hope you learned something new!

  • Upvote 4

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.