I have a feature in my game, where if your account is under 3 days old, you’ll get kicked.
I also want to have a feature where if you in a certain rank in the group, such as “Suspended” you’ll get kicked, until you have a different rank. I need help on how to do this. I’m only able to script UIs at the moment.
You can use GetRankInGroup
, which is a method of the player that gets your rank number in a group from 0-255, where 0 is not in group or 255 if you’re the owner.
Or alternatively you also haveGetRoleInGroup
, which returns the name of the role you have in the group, or “Guest” if you’re not in the group
take the role’s id, and when the player joins, check if their role is equal to the banned role’s id using plr:GetRankInGroup(groupid)
What you do is you get the players role in the group. If the players rank is the suspended rank then you kick them.
Example:
local id = groupid
local rank = -- rank num
game.Players.PlayerAdded:Connect(function(player)
if player:GetRankInGroup(id) == rank then
player:Kick()
else
print("USER IS NOT SUSPENDED")
end
end)
1 Like
For the rank, you can do:
local groupID = 00000 -- ID Here
local RankNeeded = 1 -- Rank here
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(groupID) >= RankNeeded then -- Change the operator to whatever
Player:Kick("Suspended!")
-- You can also use GetRoleInGroup, like so:
-- if Player:GetRoleInGroup(groupID) == "Suspended" then
-- Player:Kick("Suspended!")
end
if you need help with the under 3 days, you can use Player.AccountAge.
1 Like