Hi Who can help me i don't know how to do 5 attempts to kick in my Roblox Login UI.
i use else to kick but i don't know how to do attempts.
01 | if PasswordBox.Text = = "e" then |
02 | game.StarterGui:SetCore( "SendNotification" , { |
03 | Title = "System" ; |
04 | Text = "Successful Whitelisted" ; |
05 | Icon = "rbxassetid://6065986399" ; |
06 | Duration = "10" ; |
07 | callback = bindableFunction; |
08 | } ) |
09 | else |
10 | game.Players.LocalPlayer:Kick( "\nInvalid Key! Please Rejoin And Try Again." ) |
11 | end |
12 | end ) |
One way to do this would be to make a variable named tries, and increment it by 1 every time an incorrect password is entered. If tries is equal to 5, kick the player. Also, if the whole system is handled on the client a hacker can easily bypass the password check.
01 | local attempts = 0 -- Set the attempt count to 0 |
02 |
03 | if PasswordBox.Text = = "e" then |
04 | game.StarterGui:SetCore( "SendNotification" , { |
05 | Title = "System" ; |
06 | Text = "Successful Whitelisted" ; |
07 | Icon = "rbxassetid://6065986399" ; |
08 | Duration = "10" ; |
09 | callback = bindableFunction; |
10 | } ) |
11 | else |
12 | attempts + = 1 -- If they enter the wrong password, increment the attempt count |
13 | if attempts = = 5 then -- If they have tried 5 times, kick them |
14 | game.Players.LocalPlayer:Kick( "\nInvalid Key! Please Rejoin And Try Again." ) |
15 | end |
16 | end |
17 | end ) |
01 | local tries = 0 |
02 |
03 | if PasswordBox.Text = = "e" then |
04 | game.StarterGui:SetCore( "SendNotification" , { |
05 | Title = "System" ; |
06 | Text = "Successful Whitelisted" ; |
07 | Icon = "rbxassetid://6065986399" ; |
08 | Duration = "10" ; |
09 | callback = bindableFunction; |
10 | } ) |
11 | else |
12 | if tries = = 5 then |
13 | game.Players.LocalPlayer:Kick( "\nInvalid Key! Please Rejoin And Try Again." ) |
14 | elseif tries < 5 |
15 | tries = tries + 1 |
16 |
17 | end |
18 | end ) |
might work and u may have to add more ends