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

Why won't the sound play when all buzzers have been pushed?

There are 4 buzzers, and I put both of these scripts in each buzzer and none of them work;

I am also getting no errors in the output.

Script 1:

local button = script.Parent
local sound = game.Workspace.AGTDesk.GB.GoldenBuzzer
local X1 = game.Workspace.AGTDesk.X1
local X2 = game.Workspace.AGTDesk.X2
local X3 = game.Workspace.AGTDesk.X3
local X4 = game.Workspace.AGTDesk.X4
local color = BrickColor.new("Really red")

if X1.BrickColor == color and X2.BrickColor == color and X3.BrickColor == color and X4.BrickColor == color then
	sound:Play()
end

Script 2:

local button = script.Parent
local sound = game.Workspace.AGTDesk.GB.GoldenBuzzer
local X1 = game.Workspace.AGTDesk.X1
local X2 = game.Workspace.AGTDesk.X2
local X3 = game.Workspace.AGTDesk.X3
local X4 = game.Workspace.AGTDesk.X4
local color = BrickColor.new("Really red")

function buttonClick()
	if X1.BrickColor == "Really Red" and X2.BrickColor == "Really Red" and X3.BrickColor == "Really Red" and X4.BrickColor == "Really Red" then
		sound:Play()
	end
		
end

button.ClickDetector.MouseClick:Connect(buttonClick())

6 comments

0

In both scripts: It will only works if all the parts are with the same color (Really Red). In script 2: You should use the if like you made in script 1. If you can explain better what you need, I can make an elaborated answer

0

I'm making a Got Talent game, and I want a sound to play and a decal to change when all 4 buzzers are active, meaning Color = Really Red. (I will decal changing later)

0

In Script 1 you will have to use a loop to check if the buttons are in the color

0

I tried answering it. Hope it worked!

0

why not putting x1-4 in a table?

0

"Really Red" is case sensitive put "Really red" instead for starters

1 answer

Try this:

	local button = script.Parent
	local sound = game.Workspace.AGTDesk.GB.GoldenBuzzer
	local X1 = game.Workspace.AGTDesk.X1
	local X2 = game.Workspace.AGTDesk.X2
	local X3 = game.Workspace.AGTDesk.X3
	local X4 = game.Workspace.AGTDesk.X4
	local color = BrickColor.new("Really red")
	function check() 
	if X1.BrickColor == color and X2.BrickColor == color and X3.BrickColor == color and X4.BrickColor == color then
	    sound:Play()
	end end
    while true do
   check()
  print("loop") -- not needed, but its to check if the loop is working
 wait(0.5)
   end

Hope I got it all correct, best hopes for you!

8 comments

0

I didn't test this. If it didn't work, I'll try some more. :)

0

Very sorry but this didn't work for me. :(

0

Oof.

0

Any errors in output?

0

Script timeout - Exhausted.

0

Try increasing the wait time.

0

Oh and, I don't think you need the script in every button. Maybe delete all of the script's except one, and put that script in ServerScriptService. If you do that, just so you know, you will have to change the local button, because it is not the parent of the script anymore.

0

Try looking at this. It isn't centered around this certain problem but it talks about userinputs and if they are all clicked. https://scriptinghelpers.org/blog/creating-your-own-simon-says

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