What do you want to achieve?
I want to get my script to hide a ScreenGUI when on a certain team(Inmate), then when left that team your GUI pops up again.
What is the issue?
My script is not really running as expected.
local player = game.Players.Localplayer
local teams = game:GetService("Teams")
if player.Team == teams["Inmate"] then
player.PlayerGui.TeamSwitchGUI.Enabled = false
else
player.PlayerGui.TeamSwitchGUI.Enabled = true
end
What solutions have you tried so far?
RoDevs(Discord), and the dev forum. I’m a bit new to scripting.
local player = game.Players.LocalPlayer -- misspelled here
local teams = game:GetService("Teams"):GetTeams() -- Gets Teams
if player.Team == teams["Inmate"] then
player.PlayerGui.TeamSwitchGUI.Enabled = false
elseif player.Team `= teams["Inmate"] then -- Should check better than "else"
player.PlayerGui.TeamSwitchGUI.Enabled = true
end
local player = game.Players.LocalPlayer -- misspelled here
local teams = game:GetService("Teams") -- Gets Teams
wait() -- Waits so the Player loads (Just for extra security)
if player.Team == teams["Inmate"] then
print("yes") -- Remove this (I was just Debugging)
player.PlayerGui:WaitForChild("MainGui").Enabled = false -- The Gui i used (Change it please)
elseif player.Team ~= teams["Inmate"] then
player.PlayerGui:WaitForChild("MainGui").Enabled = true
end
local player = game.Players.LocalPlayer
local teams = game:GetService("Teams")
while task.wait() do
if player.Team == teams["Inmate"] then
player.PlayerGui.TeamSwitchGUI.Enabled = false
else
player.PlayerGui.TeamSwitchGUI.Enabled = true
end
end