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.
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 onlyclient side, like LocalPlayer
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…
@xxibadrxx
I said objects cannot be sent through remotes. You didn’t make it clear what you meant exactly by “location” so I assumed you were sending the reference to the object.
You cannot send objects over remotes. If the object exists on both client and server with the same reference, the reference will not be nil.
If the object is created on the server and deleted by the client, the reference will be nil
In the case of the OP, the sounds exists on the clients, so it will return nil on the server.
Basically what you said, but this method seems inefficient to me. You can save a few bytes sent between the client and server by using the method I provided.