Looks like usual simple errors that you always have when scripting something, but these are different. They doesn’t stop the script from working and doesn’t seem to make sense.
Let’s see the first error, it says that I am attempting to index nil with :WaitForChild(), so let’s go to the line 24 and check it out.
It is literally saying that gui.Parent is equal to nil, what I think it’s impossible since the script is a child of the “UserUi”
Now the second error, it says that the script could not find a child called “ItemButton”, but if you check the code and explorer you won’t find anything wrong with it:
As I said, the scripts works fine, but for some reason it always prints these errors when I play and it is very annoying. I would like to know if you guys ever had problems like this one and if is there any solution for it.
Sorry but I only know one of those errors the yellow one won’t stop the script, it’s saying that it might wait infinitely for the child (item button) because it can’t find it immediately and it should be able to. Tell me if you need more explanation cause I think mine might have grammar errors… @Br0kenT04st I wrote too quick
You wrong on locating if your make
local gui= script.Parent
local button gui:WaitForChild(“Button”)
But if your make like that 100% wrong because your button is located inside localscript so i suggest you put outside the button or you can make new variable for it like this
local Script = script
local button = Script:WaitForChild(“Button”) — so it will be working or you can make it FindFirstChild, if button then – code end, Hope ita helpful
Use new variable because your button is inside the localscript so if you make the variable script.Parent and WaitForChild button it will not found or error/stuck end so you need to move your button to outside/inside gui not localscript or you can make a new variable for it like local script = script local button= script:WaitForChild(“button”) or you can make it FindFirstChild so if button then - - your code end
Locate ur localscript outside frame is confusing me my game is using like that 1 screengui using 1 localscript and isnot located inside frame because is confusing