This code is only working in studio mode:
repeat wait() until workspace.ServerFunctions.InteractiveParts.AudioBars wait(1) -- HEARTBEAT RENDERING game:GetService("RunService").Heartbeat:connect(function(step) local AudioBars = script.Parent.AudioBars:GetChildren() for i = 1, #AudioBars do local Visual = AudioBars[i].BackVisual.SurfaceGui.AudioVisual local Audio = workspace.ServerFunctions.ServerSound.ServerMusic -- local BarLeft1 = (Audio.PlaybackLoudness / 22) if BarLeft1 <= 50 * 2 then Visual.BarLeft1.Size = UDim2.new(0.1,0,0,BarLeft1) else Visual.BarLeft1.Size = UDim2.new(0.1,0,0,100) end local BarLeft2 = (Audio.PlaybackLoudness / 11) if BarLeft2 <= 50 * 2 then Visual.BarLeft2.Size = UDim2.new(0.1,0,0,BarLeft2) else Visual.BarLeft2.Size = UDim2.new(0.1,0,0,100) end local BarMid = (Audio.PlaybackLoudness / 5) if BarMid <= 50 * 2 then Visual.BarMid.Size = UDim2.new(0.1,0,0,BarMid) else Visual.BarMid.Size = UDim2.new(0.1,0,0,100) end local BarRight1 = (Audio.PlaybackLoudness / 8) if BarRight1 <= 50 * 2 then Visual.BarRight1.Size = UDim2.new(0.1,0,0,BarRight1) else Visual.BarRight1.Size = UDim2.new(0.1,0,0,100) end local BarRight2 = (Audio.PlaybackLoudness / 26) if BarRight2 <= 50 * 2 then Visual.BarRight2.Size = UDim2.new(0.1,0,0,BarRight2) else Visual.BarRight2.Size = UDim2.new(0.1,0,0,100) end end end) --
This is inside a ServerScript, It's suppose to be keeping the SurfaceGui's in sync. What am I doing wrong?