function menu() local Cmenu = game.ReplicatedStorage.MainUI:Clone() local Cmainspawn = game.ReplicatedStorage.Spawn:Clone() local menu = game.ReplicatedStorage.MainUI local player = game.Players.LocalPlayer local b2 = menu.Img.Holder.Holder.b2 local c3 = menu.Img.Holder.Holder.c3 local d4 = menu.Img.Holder.Holder.d4 local e5 = menu.Img.Holder.Holder.e5 local f6 = menu.Img.Holder.Holder.f6 local g7 = menu.Img.Holder.Holder.g7 local h8 = menu.Img.Holder.Holder.h8 local i9 = menu.Img.Holder.Holder.i9 local j10 = menu.Img.Holder.Holder.j10 local k11 = menu.Img.Holder.Holder.k11 local l12 = menu.Img.Holder.Holder.l12 if game.Workspace.Tutorial ~= nil then Cmenu.Parent = player.PlayerGui Cmainspawn.Parent = player.PlayerGui game.Workspace.Tutorial:Destroy() player.PlayerGui.FinishUI:Destroy() player.PlayerGui.HUD:Destroy() player:LoadCharacter() elseif game.Workspace.Lvl1 ~= nil then b2.Img.Visible = false b2.TextButton.LocalScript.Disabled = false Cmenu.Parent = player.PlayerGui Cmainspawn.Parent = player.PlayerGui game.Workspace.Lvl1:Destroy() player.PlayerGui.FinishUI:Destroy() player.PlayerGui.HUD:Destroy() player:LoadCharacter() elseif game.Workspace.Lvl2 ~= nil then c3.Img.Visible = false c3.TextButton.LocalScript.Disabled = false b2.Img.Visible = false b2.TextButton.LocalScript.Disabled = false elseif game.Workspace.Lvl3 ~= nil then d4.Img.Visible = false d4.TextButton.LocalScript.Disabled = false c3.Img.Visible = false c3.TextButton.LocalScript.Disabled = false b2.Img.Visible = false b2.TextButton.LocalScript.Disabled = false elseif game.Workspace.Lvl4 ~= nil then e5.Img.Visible = false e5.TextButton.LocalScript.Disabled = false d4.Img.Visible = false d4.TextButton.LocalScript.Disabled = false c3.Img.Visible = false c3.TextButton.LocalScript.Disabled = false b2.Img.Visible = false b2.TextButton.LocalScript.Disabled = false elseif game.Workspace.Lvl5 ~= nil then f6.Img.Visible = false f6.TextButton.LocalScript.Disabled = false e5.Img.Visible = false e5.TextButton.LocalScript.Disabled = false d4.Img.Visible = false d4.TextButton.LocalScript.Disabled = false c3.Img.Visible = false c3.TextButton.LocalScript.Disabled = false b2.Img.Visible = false b2.TextButton.LocalScript.Disabled = false elseif game.Workspace.Lvl6 ~= nil then g7.Img.Visible = false g7.TextButton.LocalScript.Disabled = false f6.Img.Visible = false f6.TextButton.LocalScript.Disabled = false e5.Img.Visible = false e5.TextButton.LocalScript.Disabled = false d4.Img.Visible = false d4.TextButton.LocalScript.Disabled = false c3.Img.Visible = false c3.TextButton.LocalScript.Disabled = false b2.Img.Visible = false b2.TextButton.LocalScript.Disabled = false elseif game.Workspace.Lvl7 ~= nil then h8.Img.Visible = false h8.TextButton.LocalScript.Disabled = false g7.Img.Visible = false g7.TextButton.LocalScript.Disabled = false f6.Img.Visible = false f6.TextButton.LocalScript.Disabled = false e5.Img.Visible = false e5.TextButton.LocalScript.Disabled = false d4.Img.Visible = false d4.TextButton.LocalScript.Disabled = false c3.Img.Visible = false c3.TextButton.LocalScript.Disabled = false b2.Img.Visible = false b2.TextButton.LocalScript.Disabled = false elseif game.Workspace.Lvl8 ~= nil then i9.Img.Visible = false i9.TextButton.LocalScript.Disabled = false h8.Img.Visible = false h8.TextButton.LocalScript.Disabled = false g7.Img.Visible = false g7.TextButton.LocalScript.Disabled = false f6.Img.Visible = false f6.TextButton.LocalScript.Disabled = false e5.Img.Visible = false e5.TextButton.LocalScript.Disabled = false d4.Img.Visible = false d4.TextButton.LocalScript.Disabled = false c3.Img.Visible = false c3.TextButton.LocalScript.Disabled = false b2.Img.Visible = false b2.TextButton.LocalScript.Disabled = false elseif game.Workspace.Lvl9 ~= nil then j10.Img.Visible = false j10.TextButton.LocalScript.Disabled = false i9.Img.Visible = false i9.TextButton.LocalScript.Disabled = false h8.Img.Visible = false h8.TextButton.LocalScript.Disabled = false g7.Img.Visible = false g7.TextButton.LocalScript.Disabled = false f6.Img.Visible = false f6.TextButton.LocalScript.Disabled = false e5.Img.Visible = false e5.TextButton.LocalScript.Disabled = false d4.Img.Visible = false d4.TextButton.LocalScript.Disabled = false c3.Img.Visible = false c3.TextButton.LocalScript.Disabled = false b2.Img.Visible = false b2.TextButton.LocalScript.Disabled = false elseif game.Workspace.Lvl10 ~= nil then k11.Img.Visible = false k11.TextButton.LocalScript.Disabled = false j10.Img.Visible = false j10.TextButton.LocalScript.Disabled = false i9.Img.Visible = false i9.TextButton.LocalScript.Disabled = false h8.Img.Visible = false h8.TextButton.LocalScript.Disabled = false g7.Img.Visible = false g7.TextButton.LocalScript.Disabled = false f6.Img.Visible = false f6.TextButton.LocalScript.Disabled = false e5.Img.Visible = false e5.TextButton.LocalScript.Disabled = false d4.Img.Visible = false d4.TextButton.LocalScript.Disabled = false c3.Img.Visible = false c3.TextButton.LocalScript.Disabled = false b2.Img.Visible = false b2.TextButton.LocalScript.Disabled = false elseif game.Workspace.Lvl11 ~= nil then l12.Img.Visible = false l12.TextButton.LocalScript.Disabled = false k11.Img.Visible = false k11.TextButton.LocalScript.Disabled = false j10.Img.Visible = false j10.TextButton.LocalScript.Disabled = false i9.Img.Visible = false i9.TextButton.LocalScript.Disabled = false h8.Img.Visible = false h8.TextButton.LocalScript.Disabled = false g7.Img.Visible = false g7.TextButton.LocalScript.Disabled = false f6.Img.Visible = false f6.TextButton.LocalScript.Disabled = false e5.Img.Visible = false e5.TextButton.LocalScript.Disabled = false d4.Img.Visible = false d4.TextButton.LocalScript.Disabled = false c3.Img.Visible = false c3.TextButton.LocalScript.Disabled = false b2.Img.Visible = false b2.TextButton.LocalScript.Disabled = false end end script.Parent.MouseButton1Click:connect(menu)
I want it to check if Tutorial is in workspace, if it isn't I want it to check for Lvl1 and so on.
Note: This is a LocalScript
If "Tutorial" is in workspace:
if workspace:FindFirstChild("Tutorial") then
If "Tutorial" is not in workspace:
if not workspace:FindFirstChild("Tutorial") then
Pretty simple eh
You need to use this:
local Example = game.Workspace:FindFirstChild('Tutorial') if Example then -- This is where you would put the code if it's there else -- This is where you would do another FindFirstChild() function. end