ok so title is confusing. How would I find the user id of a player that clicked a gui button?
01 | function Click(player) |
02 | print ( "Terminal Works" ) |
03 | if player.UserId = = 293872889 then |
04 | script.Parent.Parent.Parent.Access:Play() |
05 | wait( 1 ) |
06 | script.Parent.Parent.Parent.Options.Visible = true |
07 | script.Parent.Parent.Parent.LoginFrame.Visible = false |
08 | else |
09 | print ( "User failed to access a terminal." ) |
10 | script.Parent.Parent.Parent.Denied:Play() |
11 | end |
12 | end |
13 |
14 | script.Parent.MouseButton 1 Click:connect(Click) |
If this is in a gui you should be using a LocalScript, so you can just do:
1 | local player = game:GetService( "Players" ).LocalPlayer |
Also, MouseButton1Click returns the players mouse, not the player.
Hope this helps :)
01 | local player = game:GetService( "Players" ).LocalPlayer |
02 |
03 | function Click() |
04 | print ( "Terminal Works" ) |
05 | if player.UserId = = 293872889 then |
06 | script.Parent.Parent.Parent.Access:Play() |
07 | wait( 1 ) |
08 | script.Parent.Parent.Parent.Options.Visible = true |
09 | script.Parent.Parent.Parent.LoginFrame.Visible = false |
10 | else |
11 | print ( "User failed to access a terminal." ) |
12 | script.Parent.Parent.Parent.Denied:Play() |
13 | end |
14 | end |
15 |
16 | script.Parent.MouseButton 1 Click:connect(Click) |