am tryin to make a login screen so when you input wrong password it kicks you off of the game. what i have done so far in localscript.
01 | local code = script.Parent.Parent.Code |
02 | local textbox = script.Parent.Parent.password |
03 |
04 |
05 | script.Parent.MouseButton 1 Click:Connect( function () |
06 | if textbox.Text = = code.Value then |
07 | script.Parent.Text = 'Welcome to [UnnAmeD]' |
08 | wait( 2 ) |
09 | script.Parent.Text = 'have a nice day [remember to read rules]' |
10 | wait( 4 ) |
11 | script.Parent.Parent.Visible = false |
12 | else |
13 | script.Parent.Text = 'Incorrect code' |
14 | wait( 2 ) |
15 | script.Parent.Text = 'please leave' |
16 | end |
17 | end ) |
[image]
This is in fact very easy and you can do this from server or client. In this case we can kick the player using the local script because we are kicking the client that the code is on so there are no problems. But for kicking other players you will need to use remote events.
01 | local code = script.Parent.Parent.Code |
02 | local textbox = script.Parent.Parent.password |
03 | local plr = game:GetService( "Players" ).LocalPlayer |
04 |
05 |
06 | script.Parent.MouseButton 1 Click:Connect( function () |
07 | if textbox.Text = = code.Value then |
08 | script.Parent.Text = 'Welcome to [UnnAmeD]' |
09 | wait( 2 ) |
10 | script.Parent.Text = 'have a nice day [remember to read rules]' |
11 | wait( 4 ) |
12 | script.Parent.Parent.Visible = false |
13 | else |
14 | script.Parent.Text = 'Incorrect code' |
15 | wait( 2 ) |
16 | plr:Kick( "Your code is incorrect!" ) |
17 | end |
18 | end ) |
Enjoy your day and if you have any problems please contact me