I dont understand remote events

So lately i got help for a GUI button that can activate and deactivate sound
and i tested it out in a game whit my alt.
i learned that i need remote events and i still don’t understand them even though I watched a tutorial.
script pic 2
Can someone help me out?

2 Likes

In a nutshell…

If you want the player to change anything in the game, you use a remote event. If you want the server to do any camera moving, GUI changing, or any changes to the player, you also use a remote event.

Using OnServerEvent in a ServerScript will allow the player to make changes to the game, where the player fires a FireServer in a LocalScript event to make it happen.

2 Likes

Well all i need is for the server to hear the sound played when a gui button is clicked (which only appears for me)

but only i can hear it

1 Like

If you want the player to only hear the sound, you don’t need to use a RemoteEvent for it. You can put it in a ScreenGUI and the player would only hear it.

2 Likes

Basically if you want the player(aka client) to change anything in the server so everyone can see it you will need remote event, here is an example.

local player = game.Players.LocalPlayer

player.leaderstats.Cash.Value = 9999

No one will be able to see this because it was changed for player(aka client) only so you will need remote event so everyone can see it in the leaderboard

1 Like

I created a good summary on how to deal with remotes, it should give you a good foundation on how to use them effectively.

There are some code examples, but you might find them complicated to interpret.

It’s a long read, but it summarizes years of research and experience into a couple minutes.

1 Like

As @DevHumor said you don’t need any remote event, because the remote event needed only if you want the other player to see the things that is happening in player, welp there is other situation that might need remote event on regular script but for your own situation I don’t see you need it or even any remote event

2 Likes

No i mean that i want me AND other players to hear the sound

1 Like

well if i make my local script a Script, it just completely fails to even function

1 Like

Oh, in this case, you do need a RemoteEvent if you want players to be able to change the Sound to be able to play different music, if the players supplied their own SoundID.

Also, place the Sound in workspace so everyone can hear it.

2 Likes

Oh i dont think you seem to understand what i am aiming, its my fault i dont know how to explain thing well but what im trying to do is
Me having some sort of gui that only i can use that plays a siren since i named the button “activate siren”
and for me and other players to hear it.

i srsly need help whit this thing

1 Like

Actually you can’t change the position of the camera on the server only the client

1 Like

And also when wanting changing something on the server I would use a remote function

1 Like

This will not work. Objects cannot be sent through remotes.

1 Like

Oh my bad then, because I remember I did it and was good

1 Like

I’d say do a remote function instead.

1 Like

Well can you help me out, i dont know if any of you understood what i tried to mean but are you able to help?

1 Like

Firstly, What do u want to do on the server

1 Like

i have a gui button that can play and stop a siren.
when i execute it i realised only i can hear it
and what im aiming at is for everyone in the server to hear it

1 Like

Just turn it to server script, I dont see anything on your script may mess it.

1 Like