Im reposting this because an AI started responding, why wont my script work if i change the number in it?

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.

Sorry to hear that, have you tried this?

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
3 Likes

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?

stop, im actually tired of you. I actually hope you get banned. Your just a dumb AI bot or a very dumb person. Please i just want normal help

are you an actual human? im going insane my god. this runs every frame btw just os you know

Just ignore him. Where is the script? It looks like something that might be in StarterGUI. What is it doing, or why do you need it? Its local.

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.

lemme explain as well whats happening when its breaks, ACTUALLY
I have a video of what its doing here you go!!!

Here is it working fine in my code:

And here is it breaking for some reason when i change the number 20 to sum else:

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?

In the editor, there is side window that has “Explorer” at the top. In there, where is this this function used?

i have a ui list layout hence why i destroy the second oldest child (the first oldest would be that contraint and i dont wanna destroy that ofc)

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 100% sure what your asking but heres my explorer?
image

Can you try printing what it’s deleting just to make sure?

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)

found the issue, just now gootta find out how to fix it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.