I dont understand remote events

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

Since my first reply seems to have been ignored, I’ll give it another shot with your specific case.

|Local Script|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("SoundEvent")

local Sound = --put sound here
local function Process(State)
    if not State then
        Sound:Play()
    else
        Sound:Stop()
    end
end

local function OnClick()
    Remote:FireServer()
end

script.Parent.MouseButton1Down:Connect(OnClick)
Remote.OnClientEvent:Connect(Process)
|Server Script|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = Instance.new("RemoteEvent")
Remote.Name = "SoundEvent"
Remote.Parent = ReplicatedStorage

local State = false
local function Process(Player)
    if Player.UserId == 000000 then --change the 0s to your UserId
        if not State then
            State = true
            Remote:FireAllClients(true)
        else
            State = false
            Remote:FireAllClients(false)
        end
    end
end

Remote.OnServerEvent:Connect(Process)

When a player clicks the button, the server will check if you were the one that clicked, otherwise the server won’t process the request.

If you are the one that clicked, it will make all the clients play the sound.

2 Likes

No but he wants it to be when a gui is clicked I think.

1 Like

Yes, a gui that only i can interact whit

which i already scripted

1 Like

Still wont effect cause it will work when the event fires which is after clicking

1 Like

I will explain my goal

  • create a gui button that only i can use (already done)
  • make the gui button be able to play and stop an audio which is a siren (done)
  • make other players be able to hear it instead of just me (current problem)
1 Like

The script you have right now you can turn it into server script it will not effect anything as long as you dont use stuff that is only client side, like LocalPlayer

1 Like

if you’re able to help i can add you to studio like that you can help out

1 Like

Cant he just make his own local into server script because its appear for him only + there is nothing that can effect the script or mess with it, it is more simple than yours…

1 Like

i turned the local script that is in the gui button into a normal script and it doesnt work

1 Like

His local script is not compatible on the server and even if it did work, that’s the worst possible way to solve the issue.

1 Like

can i ask if you’re able to help out if i add you in studio

1 Like

Uh weird, I will just shut up :frowning:

1 Like

Yes, you may add me to the place.

Edit:
For those who were wondering, the code in this reply was used to solve the issue

2 Likes

Remember to ask these kind of questions when you have researched on YouTube, Dev Forum, or Dev Hub.

Here is a link I found on RemoteEvents. I hope it helps! Custom Events and Callbacks | Documentation - Roblox Creator Hub

Have a great day!

1 Like

I have recently received help from wevetments
and the server script now works

1 Like