Hey! I recently made a chat command, that displays (makes visible) an overhead icon. I also want to implement a group check, whether the player sending the command is in whitelisted groups or not. Meaning if a player is not in any of those groups, it won’t do anything at all.
However, the script still runs and icon is set to visible, even when im not in any of the entered groups.
Code:
game.Players.PlayerAdded:Connect(function(Player)
if Player:IsInGroup(13947653) or (13944389) or (13944487) or (13947692) or (11447389) == true then
Player.Chatted:Connect(function(Message)
local Words = string.split(Message, " ")
if Words[1] == "!clear" then
local NameOfPlayerToClear = Words[2]
local PlayerToClear = NameOfPlayerToClear:lower()
for _, player in ipairs(game:GetService("Players"):GetPlayers()) do
if player.Name:lower():sub(1, #PlayerToClear) == PlayerToClear then
player.Character.Head.GUI.Icons.ClearedIcon.Visible = true
end
end
end
end)
else
print("You're not in a divisional group!")
end
end)