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.
Can someone help me out?
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.
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
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.
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
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.
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
No i mean that i want me AND other players to hear the sound
well if i make my local script a Script, it just completely fails to even function
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.
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
Actually you can’t change the position of the camera on the server only the client
And also when wanting changing something on the server I would use a remote function
This will not work. Objects cannot be sent through remotes.
Oh my bad then, because I remember I did it and was good
I’d say do a remote function instead.
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?
Firstly, What do u want to do on the server
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
Just turn it to server script, I dont see anything on your script may mess it.