I am trying to script a passcode gui, but for some reason the enterPressed parameter for the FocusLost event is not working.

local frame = script.Parent
local enter = script.Parent:WaitForChild("Enter")
local container = script.Parent:WaitForChild("PasscodeContainer")
local passcode = container:WaitForChild("Passcode")
local text = container.Text

print("Variables loaded.")

container.FocusLost:Connect(function(enterPressed)
	if enterPressed then
		text = container.Text
		print(text)
	else
		print(text)
	end
end)

2 comments

0

I noticed it works without checking if enter was pressed.

0

There shouldn't be a problem. Did you put it in a server script? It should be in a local.