Check if something exists

maybe im a bit too late because as TheTurtleMaster_2 said using “if not” is an option but im pretty sure using if script.Parent.Main:FindFirstChild(“Copyright”) == nil then… will also work

When I was a beginner, I had this mistake too.

You could try

local SPM = script.Parent.Main
if not SPM
then return
print(“does not exist”)
end

1 Like

Hey! To make this better and to optimize it to reduce memory/potential lag, I would instead do

script.Parent.ChildRemoved:Connect(function(instance)
    if not script.Parent:FindFirstChild("Copyright") then
        -- what to do if copyright doesn't exist
    end
end)

hope this helped :smiley:

5 Likes

that’s a very good method nice job

2 Likes