Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer
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.

2 comments

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?

0

Yes, you could do it that way, do you want an example?

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


This discussion is preserved as it was. New answers, comments, and votes are closed.