Hello,
I’m making Command Handler but I have problem with checking specific Roles in command.
Here is script with commands:
local Players = game:GetService("Players")
local roles = require(script.Parent.Staff)
local function isInGame(PlrName)
for i, plr in pairs(Players:GetPlayers()) do
if string.match(plr.Name:lower(), PlrName) then
return plr
end
end
return nil
end
local commands = {}
commands.speed = {
Name = "Speed",
Desc = "Set Player WalkSpeed",
Aliases = nil,
Roles = {roles.Owners}, -- roles that can use this command.
Run = function(sender, args)
local PlayerName = isInGame(args[1])
local amount = args[2]
if PlayerName and amount then
PlayerName.Character.Humanoid.WalkSpeed = amount
else
warn("Player isn't in Game")
end
end
}
return commands
Here is script with roles (module):
local staff = {}
staff.Owners = {
["Simon"] = 1583088521,
["Rosh"] = 226087810,
}
staff.Developers = {}
staff.Managers = {}
staff.Admins = {}
staff.Partners = { --Requirement: nil
}
return staff
I don’t have any idea how to check Roles that can use specific commands.