Heyyy! I have a little problem, I can’t make a script, in which if the folder “Example1” is empty, then it will execute something, such as print(“work”).
if game.Workspace.Example:GetChildren() == nil then
print("Im a Noob")
end
Heyyy! I have a little problem, I can’t make a script, in which if the folder “Example1” is empty, then it will execute something, such as print(“work”).
if game.Workspace.Example:GetChildren() == nil then
print("Im a Noob")
end
Show the script so people ca help you further
Yea, please show the script. 30 charr
maybe u could say if Example1:GetChildren == nil then print(“Work”)
end
Doesn’t work idk why (30char)
Ah i see the problem, gimme a sec
You can’t call GetChildren() and see if its nil.
Instead you can do this.
if #(workspace.Example:GetChildren()) == 0 then
print("Im a Noob")
end
Basically :GetChildren() returns a table value. So with putting # in front of it, it will return the number of items in that table.
Okay, I’m gonna test your script
Doesn’t work too…
Show me what you have as the current script.
Also where is your script located.
local Children = game.ServerStorage.Folder:GetChildren()
if #Children >= 1 then
print(“Children found”)
else
print(“No children found”)
end)
Btw that’s something i found online, if u wanna know more i suggest doing some research.
Thx so much for your help!!!
No problem, like i said i found that script from a article online, if u wanna learn more i suggest doing some more research online.
Okay ! (30characters…)
yes but it didn’t work for me…
You need to have a folder which is called “Example” under workspace in order for it to work