I'm trying to make a local script inside of the PlayerGui go into game.Workspace and find "Map1" or "Map2" model and this script isn't working on that part.
local found = game.Workspace:FindFirstChild("Model") while true do wait(2.5) if found.Name == "Map1" or found.Name == "Map2" then script.Parent.MapEnabled=true elseif found.Name == "" then script.Parent.MapEnabled=false end end
I moved the "local found" part around to when the loop started. I did that because it explains what found is before the script even runs.
while true do wait(2.5) local found = game.Workspace:FindFirstChild("Model") if found.Name == "Map1" or found.Name == "Map2" then script.Parent.MapEnabled=true elseif found.Name == "" then script.Parent.MapEnabled=false end end