What do you want to achieve? Keep it simple and clear!
I want to check if the player who sends the message, is in the group and has a specific rank.
What is the issue? Include screenshots / videos if possible!
I keep getting an error.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried, but I couldn’t find any.
local FullUse = {255, 111, 11, 12, 14}
local OnlyMute = {9}
local MuteAndKick = {10}
local Commands = {"mute", "general_ban", "server_ban", "announcement"}
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message,Recipient)
-- Full Use
if Player:IsInGroup(GroupId) and Player:GetRankInGroup(GroupId) == table.find(FullUse) then
if string.lower(Message) == "I AM PRO" then
print(Player.Name.." said that he is pro")
end
end
end)
end)
Error:
Line 15: if Player:IsInGroup(GroupId) and Player:GetRankInGroup(GroupId) == table.find(FullUse) then
Also in this case you do not need to use IsInGroup, since if you’re not in a group GetRankIngroup returns 0
And some advice, I recommend checking the GetRankIngroup before you make the Chatted event, so that way only those that are able to do commands will be listened for chat messages, saves having useless events unlses you plan to make general commands that anyone can use
local Players = game:GetService("Players")
local Prefix = "!"
local GroupId = 10415026
local FullUse = {255, 111, 11, 12, 14}
local OnlyMute = {9}
local MuteAndKick = {10}
local Commands = {"mute", "general_ban", "server_ban", "announcement"}
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message,Recipient)
-- Full Use
if Player:IsInGroup(GroupId) and table.find(FullUse, Player:GetRankInGroup(GroupId)) then
if string.lower(Message) == "I AM PRO" then
print(Player.Name.." said that he is pro")
end
end
end)
end)
``` It didn't show any error but it didn't print.