This script is supposed to find whether or not there is anything in a folder. The stuff inside the folder are number values. The script won’t respond at all. It doesn’t print anything on the output, or tell me any errors. Can’t seem to figure out why. Here’s the script
while true do
wait(.5)
if #ItemSave:GetChildren() > 0 then
print("found")
elseif #ItemSave:GetChildren() < 0 then
print("nothing found")
end
end
Ridiculous suggestion; but considering no print appears, is your script currently disabled ?
Otherwise, try a more straightforward check : print(#script.Parent:GetChildren())
Try this (it’s working for me when I’m testing it)
local ItemSave = game:GetService("Workspace").ItemSave
while wait(.5) do
if table.getn(ItemSave:GetChildren()) > 0 then
print("Found")
else
print("Nothing")
end
end
All told, @ReturnedTrue is right, using an event would be a better test for this. Here’s what the code would probably look like:
local ItemSave = game:GetService("Workspace").ItemSave
local Found = false --// Set this to false if there is nothing in the folder (whatever your default state is)
local function CheckValues()
if table.getn(ItemSave:GetChildren()) > 0 then
Found = true
print("Found is true")
else
Found = false
print("Found is false")
end
end
ItemSave.ChildAdded:Connect(function()
Found = true
print("Found is true")
end)
ItemSave.ChildRemoved:Connect(function()
CheckValues()
end)
In a ScreenGUI in the StarterGUI. The script creates a new box whenever an Item is added to the Player’s ItemSave. I’m helping OP (im his friend) since he’s unable to respond in time due to personal issues.
The folder is located in the player and a test value is created and parented into that folder.
Also ChildAdded and ChildRemoved are not working for some reason, is this right?
Solution was found, it was actually something else erroring but for whatever reason wasn’t being shown through output, thanks for all your contributions