What the script is suppose to do.
It is suppose to print the list of items in the scrollframe while changing the name of the Label to what that section is suppose to be.
This does work but not in ServerStorage.
I know what ServerStorage is and that's why I'm trying to get this to work.
The Script itself
--Made By MillerrIAm --------------Variables------------ Music = game:GetService("ServerStorage").MusicFolder:GetChildren() SFrame = script.Parent.ScrollingFrame Value = 0 Number = 0 -------------Main Script------------ while script.Disabled == false do for i,v in pairs(Music) do if Value == 0 then frame = SFrame.MusicFrame:Clone() frame.Visible = true frame.Parent = SFrame frame.Position = frame.Position + UDim2.new(0,0,0,Number) frame.Label.Text = v.Name Value = 1 elseif Value == 1 then frame = SFrame.MusicFrame:Clone() frame.Visible = true frame.Parent = SFrame frame.Position = frame.Position + UDim2.new(0.5,0,0,Number) frame.Label.Text = v.Name Value = 0 Number = Number + 50 end end script.Disabled = true end
Thank you for any help you give!
The contents of ServerStorage
are accessible only to the server and not to clients. What you should do is move the music folder to ReplicatedStorage
, whose contents are available to the server AND client.
Don't disable the script itself, if you have to do this you're doing something wrong. Instead use a variable that will act like a flag.
local flag = true while flag do -- Notice no == true or == false. -- ... flag = false -- Shouldn't run anymore end
Notice no == true
or == false
. If you need to test if it's falsey
, invert it with not
.
Also pls use local variables, globales are bad practice. With a local variable, it is easier to see when the variable is being declared first-time, and accessing local variables is only slightly, pretty much negligible, faster than global variables.