Search Bar System Not working for mobile devices (Text box, SurfaceGui)

I made a search bar system, it live searches as you type it out.

Here is the code:

function MatchName(String)
	for i,v in pairs(Holder:GetChildren()) do
		if v.Name == "Block" and v:IsA("Frame") then
			local Information = v:FindFirstChild("Information")
			if Information and Information:IsA("Folder") then
				local NameValue = Information:FindFirstChild("ObjectName")
				if NameValue and NameValue:IsA("StringValue") and NameValue.Value then
					if String == " " or String == "" or string.find(string.lower(NameValue.Value),String) then
						v.Visible = true;
						continue;
					end
				end
			end
			v.Visible = false;
		end
	end
end

SearchBox:GetPropertyChangedSignal("Text"):Connect(function()
	
	MatchName(SearchBox.Text)
	
	Holder.CanvasPosition = Vector2.new(0,0)
	
end)

Expected Result: (on Desktop)
image

What happens on mobile:

I am not sure if this is scripting support OR a roblox bug.

2 Likes

https://developer.roblox.com/en-us/api-reference/event/GuiObject/InputBegan

You could try using InputBegan instead and dynamically updating the top right corner “TextLabel” instance that way.