Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to make a gui visible for a certain team only?

Asked by 5 years ago

I would like my GUI to be visible for a certain team only (bright yellow("Host")) so I've tried to make a script that will just copy the GUI in player GUI

01local Person = game.Players.LocalPlayer
02 
03script.Parent.MouseButton1Click:Connect(function()
04     if Person.Name == "4581quzwi" then
05        workspace.TeamEvents.TeamEvent:FireServer(script.Parent.Text)
06        local gui = game.ServerStorage.Host
07        gui.Parent = Person.PlayerGui;
08 
09 
10    end
11end)

but for some reason, thee Gui always deletes itself (I've tried Replicated server storage lightning and workspace)

can anyone please help me with the issue or the script

-4581quzwi

2 answers

Log in to vote
0
Answered by 5 years ago
1game.Players.PlayerAdded:Connect(function(player)
2If player.Team == "TeamName" then
3script.Parent.Visible = true
4else
5script.Parent.Visible = false
6end
7end)

Please let me know if you need any help.

0
i would like to constantly check for it because when you join you are always a memebr of audience only certain people can become a host with a certain button but the script only detects it once would i be able to put the script in a while true do loop? 4581quzwi 0 — 5y
0
Yes, you could do it that way, do you want an example? JailBreaker_13 350 — 5y
Ad
Log in to vote
1
Answered by
VVoretex 146
5 years ago
Edited 5 years ago

Not sure but i think its:

1if game.Players.Localplayer.Team == "team1" then
2script.Parent.Visible = true

make sure to put the above in the gui (localscript)

if you are trying to do certain players use this:

1--//Lead Scripters
2 
3 
4local admins = {"player1","player2"}
5 
6game.Players.PlayerAdded:Connect(function(player)
7    for i = 1, #admins do
8            if admins[i] == player.Name then

Answer this question