Guten tag! I am currently trying to create a key system. How it works right now is that, you enter a 4-digit-key into the textbox, then press a button. If the code is correct, the code will print that it is correct. The same happens if it’s incorrect. (It’s going to open a GUI but I haven’t made said GUI yet.)
(My video won’t upload, heh)
Code:
local button = script.Parent -- the button that is clicked
local keyBox = button.Parent.TextBox -- the box where the key is entered
local keyEntered = button.Parent.TextBox.Text -- the key that is entered
local key = 8888 -- the key that needs to be entered
function clicked()
print("Button clicked")
if keyEntered == key then
keyEntered = key
print("Key is correct!")
else
print("Key is incorrect!")
end
end
button.MouseButton1Click:Connect(clicked)
while true do
wait (1)
print(keyEntered)
end
function clicked()
print("Button clicked")
if keyBox.Text == key then
keyEntered = key
print("Key is correct!")
else
print("Key is incorrect!")
end
end
Thanks, but that didn’t make it work. . On the bright side, after editing my script to look like that, it is now printing what was in the textbox (It was printing blank).