Well, it’ll depend on how you want to approach it but you’d need to use a LocalScript
so that you know which Team the Player is currently on
LocalScripts
are basically scripts that are handled on the client side (Or what you, as an individual see on your screen) & there are limits on where they can go, for now though we can put one inside StarterPlayerScripts
since can be client-accessed
First thing we’d need to do, is get our variables so what we can do is go ahead & define our Local Player, the Character Model, and our PlayerGui (That the Radio GUI would be parented inside):
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait() --If for some reason the Character does not load in time, "CharacterAdded:Wait()" will detect when a Character gets added back to the game
local PlayerGui = Player:WaitForChild("PlayerGui")
Now that we have our variables, the next thing we’ll need to check is our Teams here
For your Instance, I’d assume that you have 2 Teams set up in the game: Team A (Allies) & Team B (Enemies, or the SCP’s)
What we can do is implement conditional checks, to see if the Player’s TeamColor is equal to that certain Team we want to check for (Since I just realized that comparing the Player’s Team to another Team won’t be replicated):
if Player.TeamColor == BrickColor.new("Bright red") then --This would be Team A in this Instance
PlayerGui.RadioGui.Enabled = true
elseif Player.TeamColor == BrickColor.new("Black") then --This would be Team B, or the SCP's I'm assuming
PlayerGui.RadioGui.Enabled = false
end
If the Player is in Team A, then we can enable its “RadioGui” for that specific player! But if he/she is on Team B, then it won’t be enabled for them
Of course you’d need to also set up your “Radio Gui” inside the StarterGui
Service, but do make sure to set its Enabled
property to false on default when you play-test it
Hopefully though our full code should look something like this!
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait() --If for some reason the Character does not load in time, "CharacterAdded:Wait()" will detect when a Character gets added back to the game
local PlayerGui = Player:WaitForChild("PlayerGui")
if Player.TeamColor == BrickColor.new("Bright red") then --This would be Team A in this Instance
PlayerGui.RadioGui.Enabled = true
elseif Player.TeamColor == BrickColor.new("Black") then --This would be Team B, or the SCP's I'm assuming
PlayerGui.RadioGui.Enabled = false
end