Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to fix my "RemoteEventScript" (explaining maybe)?

How to fix this remotevent script you can explain me too what was wrong

 
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local vd = ReplicatedStorage:WaitForChild("volumedown")

script.Parent.MouseButton1Click:connect(function()

vd:FireAllClients()



end)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local vd = ReplicatedStorage:WaitForChild("volumedown")
vd.Name = volumed

vd.OnClientEvent:Connect(function()
game.Workspace.Audio.Volume = game.Workspace.Audio.Volume -0.1
end)


(im trying to make a volume down button)

1 answer

✓ Accepted answer

I'm guessing you're trying to make the volume go down for EVERYONE. In this case, OnClientEvent is not the way to go. You should be using FireServer and OnServerEvent instead.

Server-side is the game and the things that are visible to all clients. Client-side is the individual's device, and the things only visible to that player. For example, a GUI is client-side because only that player can see it on their screen. As for a baseplate in the workspace is server-side, because all clients can interact with it.

So if you need everyone to hear the volume change, you need to fire the server, since it's server-side.

Here's what it should look like (make sure the second block of code is in a normal script).

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local vd = ReplicatedStorage:WaitForChild("volumedown")

script.Parent.MouseButton1Click:connect(function()

vd:FireServer()

end)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local vd = ReplicatedStorage:WaitForChild("volumedown")
vd.Name = volumed

vd.OnServerEvent:Connect(function()
game.Workspace.Audio.Volume = game.Workspace.Audio.Volume -0.1
end)

2 comments

0

OOPS

0

i just realised i didnt wanted to make a volume down button but this will help me alot if i try to make a input remoteevent

This discussion is preserved as it was. New answers, comments, and votes are closed.