This is a really cool resource!
I have one suggestion to make some of the code a little bit less lengthy instead!
From lines 112-199, I can see you are attempting to loop through all the surface GUI’s in the LevelingsUi Folder while going through all of the surface GUI variables that you’ve declared. Instead, we can use the index of your loop to cut down on the use of variables, as well as make your code more efficient since you are working with the current index frame! Not criticizing your work, just contributing for resource and educational purposes towards the project! This system however is still really cool!
It will look something like this:
spawn(function()
while RunService.RenderStepped:Wait() do
for i,v in pairs(script.Parent.LevelingsUi:GetChildren()) do
if v:IsA("SurfaceGui") then
local currentFrame = v.Frame.Frame
currentFrame.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
currentFrame.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
currentFrame.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
end
end
end
end)
Instead of:
local One = script.Parent.LevelingsUi.SurfaceGui_1.Frame.Frame
local Two = script.Parent.LevelingsUi.SurfaceGui_2.Frame.Frame
local Three = script.Parent.LevelingsUi.SurfaceGui_3.Frame.Frame
local Four = script.Parent.LevelingsUi.SurfaceGui_4.Frame.Frame
local Five = script.Parent.LevelingsUi.SurfaceGui_5.Frame.Frame
local Six = script.Parent.LevelingsUi.SurfaceGui_6.Frame.Frame
local Seven = script.Parent.LevelingsUi.SurfaceGui_7.Frame.Frame
local Eight = script.Parent.LevelingsUi.SurfaceGui_8.Frame.Frame
local Nine = script.Parent.LevelingsUi.SurfaceGui_9.Frame.Frame
local Ten = script.Parent.LevelingsUi.SurfaceGui_10.Frame.Frame
local Eleven = script.Parent.LevelingsUi.SurfaceGui_11.Frame.Frame
local Twelve = script.Parent.LevelingsUi.SurfaceGui_12.Frame.Frame
local Thirteen = script.Parent.LevelingsUi.SurfaceGui_13.Frame.Frame
local Fourteen = script.Parent.LevelingsUi.SurfaceGui_14.Frame.Frame
local Fifteen = script.Parent.LevelingsUi.SurfaceGui_15.Frame.Frame
local Sixteen = script.Parent.LevelingsUi.SurfaceGui_16.Frame.Frame
spawn(function()
while RunService.RenderStepped:Wait() do
for i,v in pairs(script.Parent.LevelingsUi:GetChildren()) do
if v:IsA("SurfaceGui") then
One.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
One.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
One.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Two.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Two.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Two.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Three.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Three.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Three.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Four.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Four.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Four.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Five.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Five.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Five.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Six.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Six.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Six.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Seven.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Seven.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Seven.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Eight.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Eight.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Eight.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Nine.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Nine.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Nine.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Ten.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Ten.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Ten.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Eleven.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Eleven.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Eleven.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Twelve.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Twelve.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Twelve.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Thirteen.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Thirteen.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Thirteen.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Fourteen.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Fourteen.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Fourteen.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Fifteen.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Fifteen.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Fifteen.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
Sixteen.Size = UDim2.fromScale(1, SoundSource.PlaybackLoudness/1000)
Sixteen.Position = UDim2.fromScale(0, 1 - (SoundSource.PlaybackLoudness/1000))
Sixteen.BackgroundColor3 = Color3.fromRGB(162, (1 - (SoundSource.PlaybackLoudness/1000)) * 87, (1 - (SoundSource.PlaybackLoudness/1000)) * 46)
end
end
end
end)