I am making a training center for my game. There will be 3 teams, Trainee (white) Staff (Medium blue) and host (black). I want the host to have a button that nobody else can access. Here is my script:
1 | local Players = game:GetService( "Players" ).LocalPlayer |
2 | if Players.Teams.TeamColor = = (Players.Teams.TeamColor = = "Black" ) then |
3 | game.StarterGui.ScreenGui.TextButton.Visible = true |
4 | else |
5 | game.StarterGui.ScreenGui.TextButton.Visible = false |
6 | end |
I just figured out an easier way, it is visible to everyone but only the certain team can use it. Here is the script if anyone else needs it.
01 | local frame = script.Parent.Parent.Frame |
02 | local open = false |
03 | local others = game.Teams.Trainee |
04 | local others = game.Teams.Staff |
05 | local Person = game.Players.LocalPlayer |
06 | local Main = game.Teams.Host |
07 |
08 | frame.Visible = false |
09 | script.Parent.MouseButton 1 Click:Connect( function () |
10 | if Person.Team = = Main then |
11 | frame.Visible = true |
12 | elseif |
13 | Person.Team = = others then |
14 | frame.Visible = false |
15 | script.Parent.Text = "Not right team." |
16 | wait( 1 ) |
17 | script.Parent.Text = "Open Host Gui" |
18 | end |
19 | end ) |