I'm using the playbackloudness feature to make my song sync to the lights. It works in studio but not in a server. Please help.

for _,v in pairs(workspace.C1:GetChildren()) do
	v.Light.Enabled = true
end


function one(value) -- Turn on/off channel 1
	if string.lower(value) == "on" then
		for _,v in pairs(workspace.C1:GetChildren()) do
			v.Light.Enabled = true
		end
	else
		for _,v in pairs(workspace.C1:GetChildren()) do
			v.Light.Enabled = false
		end
	end
end

function onecolor(r,g,b) -- Change the colro of Channel 1
	for _,v in pairs(workspace.C1:GetChildren()) do
		v.Light.Color = Color3.new(r,g,b)
	end
end

function onerandom() -- Makes channel 1 have a random color
	for _,v in pairs(workspace.C1:GetChildren()) do
		v.Light.Color = Color3.new(math.random(),math.random(),math.random())
	end 
end

function two(value) -- Turn Channel 2 on or off
	if string.lower(value) == "on" then
		for _,v in pairs(workspace.C2:GetChildren()) do
			v.Light.Enabled = true
		end
	else
		for _,v in pairs(workspace.C2:GetChildren()) do
			v.Light.Enabled = false
		end
	end
end

function twocolor(r,g,b) -- Change the color of channel 2
	for _,v in pairs(workspace.C2:GetChildren()) do
		v.Light.Color = Color3.fromRGB(r,g,b)
	end
end

function tworandom() -- Random colors for channel 2
	for _,v in pairs(workspace.C2:GetChildren()) do
		v.Light.Color = Color3.new(math.random(),math.random(),math.random())
	end 
end


function three(value) -- Turn Channel 3 on or off
	if string.lower(value) == "on" then
		for _,v in pairs(workspace.C3:GetChildren()) do
			v.Light.Enabled = true
		end
	else
		for _,v in pairs(workspace.C3:GetChildren()) do
			v.Light.Enabled = false
		end
	end
end

function threecolor(r,g,b) -- Change the color of channel 3
	for _,v in pairs(workspace.C3:GetChildren()) do
		v.Light.Color = Color3.fromRGB(r,g,b)
	end
end

function threerandom() -- Random colors for channel 3
	for _,v in pairs(workspace.C3:GetChildren()) do
		v.Light.Color = Color3.new(math.random(),math.random(),math.random())
	end 
end

function flash(value) -- Turn the color strip on or off
	if string.lower(value) == "on" then
		for _,v in pairs(workspace.flash:GetChildren()) do
			v.Color = Color3.fromRGB(255, 255, 255)
		end
	else
		for _,v in pairs(workspace.flash:GetChildren()) do
			v.Color = Color3.fromRGB(0,0,0)
		end
	end
end

function snow(value) do
	if string.lower(value) == "on" then
		workspace.Snow.ParticleEmitter.Enabled = true
	else
		workspace.Snow.ParticleEmitter.Enabled = false
	end
end
end

function playmusic(id)
	workspace.Music:Stop()
	workspace.Music.SoundId = "rbxassetid://" .. id
	workspace.Music:Play()
end
one("off")
playmusic(557526729)
workspace.Music.Ended:connect(function()
	playmusic(1223884123)
end)

while true do
	wait(.1)
	if workspace.Music.PlaybackLoudness > 400 then -- This is where it starts.
		snow("off")
		three("off")
		flash("off")
		one("on")
		onecolor(0,255,0)
		two("on")
		twocolor(255,0,0)
	end	
	if workspace.Music.PlaybackLoudness > 300 then
		snow("off")
		flash("on")
		three("on")
		threecolor(255,255,255)
		two("on")
		twocolor(255,255,255)
		one("on")
		onecolor(255,255,255)
	else
		flash("off")
		one("off")
		two("off")
		three("on")
		threerandom()
		snow("on")
	end
end

1 comment

0

put it on Starter GUI