SmakToj
(SmakToj)
May 24, 2022, 5:11pm
#1
Hello, I am trying to make a sound board for one of my games. It is a simple test that I wanted to try out. I put Many text buttons in a grid. Depending on which button I press It will play a different sound. And I want everyone in the server to be able to hear the sounds.
However it does not seen to be working. And I can not seem to figure out how to fix it. Whenever I click on a sound It does not play. The only time it did play is when I used a local script. But when I use a local script no one else can hear it.
This is how I organised it
Starter GUI > Frame > Text Buttons > Audio and Script.
script.Parent.MouseButton1Up:Connect(function()
script.Parent["Crowd Reactions 1 (SFX)"]:Play()
end)
I tried to see if the game was detecting me clicking on a sound button my adding…
print("Test")
… to the script. And surely enough it appeared in the output.
I know this is probably an easy fix but I don’t have much experience in scripting because im mostly a builder so don’t get mad at me if it is dumb mistake.
All help is appreciated
1 Like
zCrxtix
(zavier)
May 24, 2022, 5:16pm
#2
I’m not too sure, but is .Playing true?
1 Like
Valkyrop
(JustAGuy)
May 24, 2022, 5:16pm
#3
You’ll need to fire a remote event to the server and play it from there. If you want it to play to everyone.
SmakToj
(SmakToj)
May 24, 2022, 5:18pm
#4
Do you mean like this
script.Parent.MouseButton1Up:Connect(function()
script.Parent["Crowd Reactions 1 (SFX)"]:Play(true)
end)
With true right after play?
zCrxtix
(zavier)
May 24, 2022, 5:19pm
#5
SmakToj
(SmakToj)
May 24, 2022, 5:22pm
#6
Thank you, but this script is only for the client.
Plays a Sound
locally, meaning the sound will only be heard by the client calling this function,
So that won’t work.
Thanks anyways!
zCrxtix
(zavier)
May 24, 2022, 5:24pm
#7
Oh, I misunderstood what you wanted. You would have to do what @Valkyrop suggested.
1 Like
SmakToj
(SmakToj)
May 24, 2022, 5:26pm
#8
Sorry if I was unclear about what I wanted.
I am looking into that right now.
Thanks!
1 Like
SmakToj
(SmakToj)
May 24, 2022, 5:55pm
#9
When I try to fire a remote event, an error appears in the output that says:
13:45:16.944 FireServer can only be called from the client - Server
I changed everything up so now the script looks like this:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SoundBoard = ReplicatedStorage:WaitForChild("SoundBoard")
local Sound = script.Parent["Crowd Reactions 1 (SFX)"]
script.Parent.MouseButton1Up:Connect(function()
print("Test")
SoundBoard:FireServer(Sound)
end)
I added a remote event to ReplicatedStorage Called SoundBoard
I also added a script to ServerScriptService:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SoundBoard = ReplicatedStorage:WaitForChild("SoundBoard")
SoundBoard.OnServerEvent:Connect(function(player, sound)
sound:Play()
end)
It still does not seem to be working.
You should try
script.Parent.MouseButton1Up:Connect(function()
script.Parent.CrowdReactions1(SFX):Play()
end)
(Without the spaces is well)
RMofSBI
(RMofSBI)
May 24, 2022, 6:24pm
#11
Not sure if this has been mentioned but make sure your sounds are parented to the workspace directly and everyone will hear them.
SmakToj
(SmakToj)
May 24, 2022, 6:32pm
#12
So you mean adding them into the workspace rather then having them in the gui?
RMofSBI
(RMofSBI)
May 24, 2022, 8:00pm
#13
Yes, just the sounds. . . . . .
This should work better, and look cleaner.
Local sound = Script.parent.(Your sound here)
script.parent.Mousebutton1Click:Connect(function)
sound:play
end()
lemme know if this works
Oh wait i made a minor mistake here.
this is how it Should be
Local sound = script.parent.(Your sound here)
script.parent.Mousebutton1Click:Connect(function)
sound:play()
end()