I made a script in which I press a button and then it makes a noise, and then another noise. Here's my script:
local Switched = script.Parent.Switched function onClicked() if Switched == false then Switched = true script.Parent.On:Play() wait(0.5) script.Parent.Off:Play() wait(0.2) Switched = false end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Here's a nice fix;
local Switched = false -- You can't change a Objects value. Unless Switch is a BoolValue local CD = script.Parent:WaitForChild('ClickDetector') --The ClickDetector local On = script.Parent:WaitForChild('On') --On local Off = script.Parent:WaitForChild('Off') -- Off CD.MouseDown:Connect(function() --You can use MouseDown if Switched == false then Switched = true On:Play() wait(0.5) Off:Play() wait(0.2) Switched = false end end)
This should work, though I was not sure what Switched Was because there was no value.
If this helped then please accept answer :D