I want to change the local min rank to just user id's

local GlitchURL = “”

function rankUser(UserId, RoleId)
game:GetService(“HttpService”):GetAsync(GlitchURL … “ranker?userid=” … UserId … “&rank=” … RoleId)
end

local groupId = 1234567
local minimumRankToUseCommands = 254

local groupService = game:GetService(“GroupService”)
local groupInfo = groupService:GetGroupInfoAsync(groupId)

function getNextRank(CurrentRank)
for i = 1, #groupInfo.Roles do
local RankId = groupInfo.Roles[i].Rank
if RankId > CurrentRank then
return RankId
end
end
end

function getPreviousRank(CurrentRank)
table.sort(groupInfo.Roles, function(a,b) return a.Rank > b.Rank end)
for i = 1, #groupInfo.Roles do
local RankId = groupInfo.Roles[i].Rank
if RankId < CurrentRank then
return RankId
end
end
end

game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(groupId) >= minimumRankToUseCommands then
Player.Chatted:Connect(function(Message)
local LowerCaseMessage = string.lower(Message)
if not string.find(LowerCaseMessage, “!rank”) and not string.find(LowerCaseMessage, “!promote”) and not string.find(LowerCaseMessage, “!demote”) then return end
local SplitMessage = string.split(Message, " ")
local PlayerToRank = game.Players[SplitMessage[2]]

		if Player:GetRankInGroup(groupId) >  PlayerToRank:GetRankInGroup(groupId) then
			if string.find(LowerCaseMessage, "!rank") then
				local RankId = SplitMessage[3]
				rankUser(PlayerToRank.UserId, RankId)
			elseif string.find(LowerCaseMessage, "!promote") then
				local PlayerCurrentRank = PlayerToRank:GetRankInGroup(groupId)
				local RankId = getNextRank(PlayerCurrentRank)
				rankUser(PlayerToRank.UserId, RankId)
			elseif string.find(LowerCaseMessage, "!demote") then
				local PlayerCurrentRank = PlayerToRank:GetRankInGroup(groupId)
				local RankId = getPreviousRank(PlayerCurrentRank)
				rankUser(PlayerToRank.UserId, RankId)
			end
		end
	end)
end

end)

Please use the code tags & describe what your issue is in the description.

First off, please put your code in code tags as @Noah recommended, and second off, please never EVER use Glitch to host your bot.

If you want to see why, I recommend checking out this post.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.