sorry, an AI started responding to my last post. I know that because he responsed as soon as i did, he kept saying that theres a built in number variable, then said it didnt exist, and tried to get me to use a service called “getchildrenservice” that does not even exist, let alone him using it in the script he gave me.
Heres my current NON-AI script that i made:
local count = #script.Parent.Frame.ScrollingFrame:GetChildren()
print(count)
if count >= 20 then
print("aaaaaa")
script.Parent.Frame.ScrollingFrame:GetChildren()[2]:Destroy()
end
Thank you for any HUMAN help, if i get another AI bot respinding to me i quit.
local number = {
zero=0,
one=1,
two=2,
three=3,
four=4,
five-5,
six=6,
seven=7,
eight=8,
nine=9
}
local ScrollingFrameService = Game:GetService("script.Parent.Frame.ScrollingFrame")
local GlobalPrintService = print
local count = ScrollingFrameService #:GetChildren() GlobalPrintService(count) if count >= tonumber(number.two..number.zero) then print("aaaaaa") ScrollingFrameService :GetChildren()[tonumber(number.two)]:Destroy() end
The code inside your if statement is going to run only if your ScrollingFrame has at least 20 children, so it is not going to run if the number of children is lower than that. So, what part of the script isn’t working as intended?
I provided a solution to your problem and you are treating me in horrible ways, does the internet said. I am simply providing a solution to your problem by creating a number variable named “number” which contains numbers between 0 to 9. These numbers can be used to form bigger numbers while being more efficient and easier to read and type.
so heres what its doing exactly:
it chekc a GUI element and if that element has more than 20 items then it destroys the 2nd oldest one
For some reason (forgot to specifiy) if i change that number the code breaks, otherwise its fine
The script counts the number of children instances inside of the scrolling frame. Then it checks if the number is greater than or equal to 20. So if you change the number 20 to a number higher then the number of children the script will not run.
Do you have any UI constraints or anything inside of the children of the scrolling frame? Ex: UI grid layout, UI list layout. If so maybe that’s getting accidently deleted?
When you are destroying the second child of the scrollingframeservice, the second child may not be in the same order as it appears in your studio. Destroying the second object of a folder may yield different results between studio and testing the game.
not sure if that will help… sadly as the labels that get made are all called text label. If it makes it easier image my game as the roblox built-in console because thats basically what it is. I made my own print func called PrintTo and its basically just how i print to this custom console.
(sorry for the long reply im trying to give u guys as much info as i can so i cang get help)