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 4 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

local Person = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
     if Person.Name == "4581quzwi" then
        workspace.TeamEvents.TeamEvent:FireServer(script.Parent.Text)
        local gui = game.ServerStorage.Host
        gui.Parent = Person.PlayerGui;


    end
end)

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 4 years ago
game.Players.PlayerAdded:Connect(function(player)
If player.Team == "TeamName" then
script.Parent.Visible = true
else
script.Parent.Visible = false
end
end)

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 — 4y
0
Yes, you could do it that way, do you want an example? JailBreaker_13 350 — 4y
Ad
Log in to vote
1
Answered by
VVoretex 146
4 years ago
Edited 4 years ago

Not sure but i think its:

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

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

if you are trying to do certain players use this:

--//Lead Scripters


local admins = {"player1","player2"}

game.Players.PlayerAdded:Connect(function(player) 
    for i = 1, #admins do
            if admins[i] == player.Name then


Answer this question