Hello, I have problem with my script. I'd like to create script that hides GUI after player changes on a specific team. Script I had:
local Player = game.Players.LocalPlayer
local TB = game.StarterGui.ScreenGui.Frame
TB.Visible = false
if game.Player.TeamColor == BrickColor.new('Really red') then
TB.Visible = true
end
Actually worked but It worked only after joining game. But I want to make it execute every time after player changes team.
Script that should work:
local function onTeamColorChanged()
local TB = game.StarterGui.ScreenGui.Frame
TB.Visible = false
if game.Player.TeamColor == BrickColor.new('Really red') then
TB.Visible = true
end
end
Player:GetPropertyChangedSignal("TeamColor"):Connect(onTeamColorChanged)
I want anyone here help me with it.

3 comments
If you are confused, then tell me
Thank you.
Works perfectly! Thank you.