I want to make a custom chat command that will only function if the player is above a certain rank in a group. How can I do that?
✓ ANSWER ACCEPTED
How to make custom chat commands that only work for people that are above a certain rank in a group?
1 answer
✓ Accepted answer
It would have been great if you at least made an attempt. But what you'd have to do is define the Player, then create a function for when they chat.
-- [[ SERVICES ]] --
Players = game:GetService('Players')
-- [[ MAIN SCRIPT ]] --
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
if Player:GetRankInGroup(0) >= 1 then -- change 0 to GroupId, change 1 to minimum RankId
-- message stuff here
end
end)
end)
2 comments
0
thank you! just for confirmation, this is a script that will go into ServerScriptService right?
0
Yes
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
This is not a request website