[RESOLVED] Role commands

Does anyone could help me? So recently I bought some custom role commands and I really forgot to ask him to make it for staff only can use it and now I lose his contacts. so can anyone help me? Here the scripts anyways…

RESOLVED

1 Like

here yah go!

Role commands 

local Players = game:GetService("Players")

local Settings = {Prefix = "!"}
local Commands = {}

local YourGroup = 10343708 -- Your Group Id!
local StaffRanks = {} --Ranks of staff here!


function GetArgs(String)
	return string.split(String, " ")
end

Players.PlayerAdded:Connect(function(Player)
	if Player:IsInGroup(YourGroup) and table.find(StaffRanks,Player:GetRankInGroup(YourGroup)) ~ nil then 
		Player.Chatted:Connect(function(String)
			local Arguments = GetArgs(String)
			local Command = Arguments[1]

			local Prefix = string.sub(Command, 0, 1)
			local Command2 = string.sub(Command, 2)
			print(Command2)
			if Prefix ~= Settings["Prefix"] then return end

			local CommandFunction = Commands[Command2]

			if CommandFunction then CommandFunction(Player, Arguments) end
		
		end)
	end
end)

It checks if the player is in the group and if their rank is a staff rank, put the ranks of the Staff in the “StaffRanks” table

1 Like