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

How do I deny visibility of a certain ScreenGui to a certain team?

I have a team change Gui that I dont want a team that is in prison to see so they cant get out using the gui although I ran into a wall because the script doesn't do anything at all.

No errors in output, the script is enabled, the gui

is enabled to begin with.

LocalScript located inside StarterPlayerScripts

local TeamService = game:GetService("Teams")
local Team = TeamService:FindFirstChild("Incarcerated")
local player = game.Players.LocalPlayer

local check = false
local gui = player.PlayerGui:WaitForChild("team change gui")

if player.Team == Team then
       gui.Enabled = true 
    check = true
 if check ~= true then
     gui.Enabled = false
   end
end

1 answer

✓ Accepted answer

There are some unnecessary things here. Also let's put this localscript inside the ScreenGui that you want to disappear

EDIT: MAKE SURE YOUR GUI IS ENABLED=FALSE BY DEFAULT AND THAT RESETONSPAWN PROPERTY OF THE SCREENGUI IS SET TO FALSE

local TeamService = game:GetService("Teams")
local Team = TeamService:FindFirstChild("Incarcerated")
local player = game.Players.LocalPlayer

function change()
	if player.Team == Team then
		script.Parent.Enabled=false
	else
		script.Parent.Enabled=true
	end
end

player:GetPropertyChangedSignal("Team"):Connect(change)
change()

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