So admin commands are kind of necessary for a lot of people but hard to understand and hard to add new one. SO to do that I made a very SIMPLE to understand admin command module. Here is how it works.
Step 1 First make a module script in replicatedstorge or anywhere you want
Step 2 Insert this script in the module script
To make the abbreviation possible I use parogrammers this post to help me achieve it.
P.S: I am sure you all can make teleport to and teleport player to your self or to another player command your self
local Commands = {}
local function getplayer(abbreviation)
for i,v in ipairs(game:GetService("Players"):GetPlayers()) do
if v.Name:lower():sub(1,abbreviation:len()) == abbreviation:lower() then
return v
end
end
end
local Admins = {} -- Admins that can use the commands
function Commands.AddCommand(Player,Prefix,Name,Function,DoReason)
Player.Chatted:Connect(function(Message)
if table.find(Admins,Player.Name) then
local MSG = Message:split(" ")
if MSG[1] == Prefix..Name then
local plrname = MSG[2]
local reason
if DoReason then
reason = MSG[3]
end
if reason == nil then
reason = "Unknown"
end
local plr2dothingwith = getplayer(plrname)
if plr2dothingwith then
if DoReason then
Function(Player,reason)
else
Function(Player)
end
end
end
end
end)
end
return Commands
Step 3 Then add a script. Again where ever you want and paste this in it.
local function Kick(plr,reason)
plr:Kick("Kicked For "..reason)
end
local Module = require(script.Parent.ModuleScript)
game.Players.PlayerAdded:Connect(function(plr)
Module.AddCommand(plr,"!","kick",Kick,true)
end)
And boom your done just like that you added a kick command script in just 3 simple steps!
Now I hope you all like this script and if you do let me know by voting in the poll.
- its good (I dont need it / already know how to make it)
- its helpful (I will surely use it)
- its bad (bruh it sucks)
0 voters