Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can anyone help me figure out why FindFirstChild always returns nil?

Asked by 4 years ago
local folder = game.Workspace:FindFirstChild("Invisiblity Folder")
    if folder==nil then
        newfolder = Instance.new("Folder")
        newfolder.Parent=game.Workspace
        newfolder.Name="Invisibility Folder"
        print("made folder")
    else
            print("folder here")
    end

It creates a brand new folder everytime I run this code, even if a folder is already in the workspace. Anyone understand why? Running from a Server-Side script.

0
the folder may not be loaded in yet and so the script creates a new folder and then the original folder eventually loads in, try WaitForChild() Code1400 75 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

You made a typo in Invisibility on your first line, you wrote Invisiblity but the folder you are creating is named Invisibility

0
Jeez. Thank you very much. Void_Frost 571 — 4y
Ad

Answer this question