So if I try doing this:
local text = script.Parent.Parent.TextBox.Text script.Parent.MouseButton1Click:Connect(function() if game.ReplicatedStorage.Maps:WaitForChild(text) == nil then print("Invalid") else print("valid") end end)
BUT I keep getting an infinite yield: Infinite yield possible on 'ReplicatedStorage.Maps:WaitForChild("")
How do I make it work without an infinite yield?
You are waiting for the child of Maps here.
if game.ReplicatedStorage.Maps:WaitForChild("Child's name" ) == nil then
It looks like you're trying to see if a map is found matching the text in the textbox. The WaitForChild("") yields if it doesn't find a matching child. Instead, you can try this:
local text = script.Parent.Parent.TextBox.Text local maps = game.ReplicatedStorage.Maps script.Parent.MouseButton1Click:Connect(function() for _, v in pairs(maps:GetChildren()) do if string.lower(v.Name) == text then print("Valid") break else print("Invalid") break end end end)
sorry if this doesn't look nice, it is my first post