There is a specific thing that might be in the workspace that I want to remove at the start of a server.
Will this be true if the part is there?
if game.Workspace.Brick221==true then --stuff end
No, it won't be true
since it would be the Brick!
Actually, if it's not there, it will cause an error.
We use the method FindFirstChild
to find children when we don't know if they are there. Instead of erroring, they return nil
:
if workspace:FindFirstChild("Brick221") ~= then
Or, since values other than false
and nil
are truey, we can shorten it to just:
if workspace:FindFirstChild("Brick221") then
Also this is not a stupid question! There's really only this one way to do it (due to this being the only API to do so), so if you didn't know about FindFirstChild
you wouldn't have been able to come up with it.