Can a Textbox be used on a SurfaceGui?

Hello! I was wondering if a Textbox will work on a SurfaceGui, I have tried using the FocusLost function on both the Server and Client. The function appears to not be run. I have left my script below if it helps.

local textBox = script.Parent --what I have previously used

local function focusLost(enterPressed)
	if enterPressed then
		print("Focus was lost because enter was pressed!") --this is not being printed
	end
end

script.Parent.FocusLost:Connect(focusLost)

(I have the Script as a child of the Textbox which is on a SurfaceGui, I have tried both LocalScripts and normal Scripts)

If Textboxes do not work on a SurfaceGui, then does anyone know how I am meant to use them?

2 Likes

I got mine working, it’s just that I put the SurfaceGui onto StarterGui and set its Adornee to the target part so that the localscript loads to the client.

2 Likes

Thank you, I would not have thought to put the SurfaceGui in StaterGui as I thought that StarterGui was only for a ScreenGui.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.