Team Radio GUI, help please

Hello fellow Robloxians, I’m making a SCP game and need help to make a Radio GUI that only some teams such as Mobile task Force can see. For example, teamA can see it and talk in it but teamB cant.

I’ve been trying to make one for a couple days now and really can’t figure it out, if anyone could help me make a Radio like this, I will be so happy.

2 Likes

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
2 Likes

I tested it and it didn’t work for some odd-reason, there was a error that said “Could not find PlayerGui

Did you make sure to put it as a LocalScript, and inside StarterPlayerScripts?

Yes, I put a local script inside of StarterPlayerScripts and followed what you said.

Do you have a RadioGui already set up as a GuiObject in the StarterGui when you play it?

yes I do, I have exactly everything

Ok what

This works completely fine on my side? I don’t know what you’re exactly doing, but could I see the hierarchy of the Explorer is like?

Lol, my apologies. I’ve fixed it
The problem was that I messed up the script, well thank you for helping me!

1 Like