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)
Try this.. All I did was move the text variable into the click function
local maxTries = 3 local currentAttempts = 0 local pass = "DEV@2019" local banMessage = "Attempting to access a password-protected game" local button = script.Parent button.MouseButton1Click:Connect(function() local passBox = game.StarterGui.ScreenGui.PassTextBox 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)