Hi, so I have a code here. I have no idea how to script lua, all I did is get a script from a youtube video and paste these particle emitters from a button. How do I make it so it’ll trigger when the audio is loud.
Here is my code, I don’t expect anyone to correct it since I think its all wrong but any help to make this work is appreciated!
game:GetService("RunService").Heartbeat:Connect(function()
local loud = workspace.Music.PlaybackLoudness * 0.05 + 1
for i,v in pairs(game.Workspace.FW3:GetChildren())
do
if v.Name == "FW_3"
then
spawn(function()
v.FW.F1.P1.Enabled = true
v.FW.F1.P2.Enabled = true
v.FW.F1.P3.Enabled = true
v.FW.F1.P4.Enabled = true
v.FW.F1.P5.Enabled = true
v.FW.F1.Sound:Play()
v.FW.F2.P1.Enabled = true
v.FW.F2.P2.Enabled = true
v.FW.F2.P3.Enabled = true
v.FW.F2.P4.Enabled = true
v.FW.F2.P5.Enabled = true
wait(0.2)
v.FW.F1.P1.Enabled = false
v.FW.F1.P2.Enabled = false
v.FW.F1.P3.Enabled = false
v.FW.F1.P4.Enabled = false
v.FW.F1.P5.Enabled = false
v.FW.F1.Sound:Pause()
v.FW.F2.P1.Enabled = false
v.FW.F2.P2.Enabled = false
v.FW.F2.P3.Enabled = false
v.FW.F2.P4.Enabled = false
v.FW.F2.P5.Enabled = false
v.FW.F2.Sound:Pause()
v.FW.F3.P1.Enabled = true
v.FW.F3.P2.Enabled = true
v.FW.F3.P3.Enabled = true
v.FW.F3.P4.Enabled = true
v.FW.F3.P5.Enabled = true
v.FW.F3.Sound:Play()
wait(0.2)
v.FW.F3.P1.Enabled = false
v.FW.F3.P2.Enabled = false
v.FW.F3.P3.Enabled = false
v.FW.F3.P4.Enabled = false
v.FW.F3.P5.Enabled = false
v.FW.F3.Sound:Pause()