soo im trying to make a script where if there is not a curtain part it functions this is what i've tried to do but it just errors cuz it can't find the part so the rest of the script won't play
if game.Workspace["Wheat Big"]:FindFirstChildOfClass('Weld') == nil then script.Parent:Remove() end
The question was quite unclear, but Ive tried to understand.
You should first check if "Wheat Big" is in workspace. Otherwise it will error as it is not in workspace (aka. nil). After that you can check if the Weld is inside "Wheat Big" like I did here. I hope this clears up some stuff.
local Wheat = workspace:FindFirstChild("Wheat Big") if Wheat then local Weld = Wheat:FindFirstChild("Weld") if Weld then print("Found Weld!") script.Parent:Destroy() else print("Weld does not exist!") end else print("Wheat Big does not exist!") end
(if this seemed to work an upvote would be appreciated)