How do I make this gui work for players on a certain team? I tried many ways and even check other post’s and still found nothing.
Here is the current script and video on what I’m trying to perform but for teams
for _, player in pairs(PlayerService:GetPlayers()) do
--Who can use the command
--if powers >= Moderator then
local Decoded = messageToDecode:split(" ")
Decoded[2] = string.lower(Decoded[2])
print(Decoded)
if string.lower(player.Name) ~= Decoded[2] then
for _, teams in pairs(Team:GetChildren()) do
local teamName = teams.Name
local DecodedTeamName = messageToDecode:split(" &$%"..teamName.." ")
DecodedTeamName[3] = DecodedTeamName[2]
DecodedTeamName[2] = teamName
if DecodedTeamName[3] then
if player.Team == Team[DecodedTeamName[2]] then
-- code
end
end
end
end
game.ReplicatedStorage.AdminRemoteEvents.SendCommand.OnServerEvent:Connect(function(player, messageToDecode)
local Decoded = lowermessage:split(" ")
local removeSlash = Decoded[1]:split("/")
removeSlash[1] = "/"
local cmdName = removeSlash[2]
if commands[cmdName] then
commands[cmdName](player, powers, messageToDecode)
end
end)