So, I basically created a pretty simple GUI script that forces you to input a given password to be given access to the game.
Now, for some reason, whenever I input the correct password, it still says it is wrong.
Help?
local maxTries = 3
local currentAttempts = 0
local pass = "DEV@2019"
local banMessage = "Attempting to access a password-protected game"
local button = script.Parent
local passBox = game.StarterGui.ScreenGui.PassTextBox
button.MouseButton1Click:Connect(function()
if currentAttempts == 3 and maxTries == 3 then
game.Players.LocalPlayer:Kick(banMessage)
else
if passBox.Text == pass then
button.Text = "Game loading..."
wait(1)
game.StarterGui.ScreenGui:Destroy()
else
if passBox.Text ~= pass then
button.Text = "Wrong password"
end
wait(1)
currentAttempts = currentAttempts + 1
button.Text = "Submit"
end
end
end)

3 comments
You should really use GetPropertyChangedSignal() here. It is extremely useful for this situation.
^^
I made something like this not too long ago, but instead of making the password a variable in the script I made it a string value inside of the part.