Login Gui error

I have a login GUI, the gui is work, but when I only type code, the script is working too.
My script:

script.Parent.TextButton.MouseButton1Click:Connect(function()
	if script.Parent.Password.Text == "hi" then
		if script.Parent.Code.Text == "hi" then
			print("wow")
		end
	end
end)

Video

That shouldn’t really make an error like that, and I can confirm it too, as I just checked it with the exact same code. But could you give a screenshot of your UI layout?

The only problem possible is that either your password UI is named ‘Code’ while your code UI is named ‘Password’.

Can you try this:

script.Parent.TextButton.MouseButton1Click:Connect(function()
	if script.Parent.Code.Text == "hi" then
		if script.Parent.Password.Text == "hi" then
			print("wow")
		end
	end
end)

If it works as expected, your UI naming is wrong.

2 Likes