Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
Edited 6 years ago

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

Log in to vote
0
Answered by 6 years ago

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)
0
OOPS Lolamtic 63 — 6y
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 Lolamtic 63 — 6y
Ad

Answer this question