Hey all, I’m trying to create a plugin command with Basic Admin Essentials 2.0, I have made the notification appear when a player says “!help”, however, I’m unsure on how to make it so the admin is teleported to the player who ran the command.
local Plugin = function(...)
local Data = {...}
-- Included Functions and Info --
local remoteEvent = Data[1][1]
local remoteFunction = Data[1][2]
local returnPermissions = Data[1][3]
local Commands = Data[1][4]
local Prefix = Data[1][5]
local actionPrefix = Data[1][6]
local returnPlayers = Data[1][7]
local cleanData = Data[1][8]
-- Plugin Configuration --
local pluginName = 'help'
local pluginPrefix = actionPrefix
local pluginLevel = 0
local pluginUsage = "" -- leave blank if the command has no arguments
local pluginDescription = "Calls for an in-game admin."
-- Example Plugin Function --
local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
local Player = Args[1]
for i,v in pairs(game.Players:GetChildren()) do
if returnPermissions(v) >= 1 then
remoteEvent:FireClient(v,"Notif",Player.Name.." requires a MR+", "Click to teleport", "")
end
end
end
Are you unsure how to teleport the player to another player? If so, you can make a script to get the position of the person requesting help’s HumanoidRootPart, then use Humanoid:MoveTo() on the admin’s Humanoid.
– Return Function –
return {
pluginName,
pluginPrefix,
pluginLevel,
pluginUsage,
pluginDescription,
pluginFunction
}
end
return Plugin
I solved my own problem, thanks to Mr. Brightside, this is what I ended up doing.
local Plugin = function(…)
local Data = {…}
-- Included Functions and Info --
local remoteEvent = Data[1][1]
local remoteFunction = Data[1][2]
local returnPermissions = Data[1][3]
local Commands = Data[1][4]
local Prefix = Data[1][5]
local actionPrefix = Data[1][6]
local returnPlayers = Data[1][7]
local cleanData = Data[1][8]
-- Plugin Configuration --
local pluginName = 'help'
local pluginPrefix = actionPrefix
local pluginLevel = 0
local pluginUsage = "" -- leave blank if the command has no arguments
local pluginDescription = "Calls for an in-game admin."
-- Example Plugin Function --
local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
local Player = Args[1]
for i,v in pairs(game.Players:GetChildren()) do
if returnPermissions(v) >= 1 then
remoteEvent:FireClient(v,"Notif",Player.Name.." requires a MR+", "Click to teleport", "")
end
end
end
-- Return Function --
return {
pluginName,
pluginPrefix,
pluginLevel,
pluginUsage,
pluginDescription,
pluginFunction
}
Guessing you have figured it out by now but this is the one my group uses:
local Plugin = function(...)
local Data = {...}
local remoteEvent = Data[1][1]
local remoteFunction = Data[1][2]
local returnPermissions = Data[1][3]
local Commands = Data[1][4]
local Prefix = Data[1][5]
local actionPrefix = Data[1][6]
local returnPlayers = Data[1][7]
local cleanData = Data[1][8]
local pluginName = 'help'
local pluginPrefix = actionPrefix
local pluginLevel = 0
local pluginUsage = ""
local pluginDescription = "Calls for an in-game admin."
local playerService = game:GetService('Players')
local function pluginFunction(Args)
local Player = Args[1]
remoteEvent:FireClient(Player,'Hint','System | Help Request','Successfully called assistance, a Moderator will assist you shortly.')
for a,b in next,playerService:GetPlayers() do
local PlayerPermission = returnPermissions(b)
if PlayerPermission > 0 then
remoteEvent:FireClient(b,'Notif','Support Needed','Click to assist, '..Player.Name.."" ,{"Support", Player.Name})
end
end
end
remoteEvent.OnServerEvent:connect(function(Player,Key,...)
local Data = {...}
if Data[1] == "Notification Transfer" then
if Data[2][1] == "Support" then
Player.Character.HumanoidRootPart.CFrame = game.Players[Data[2][2]].Character.HumanoidRootPart.CFrame*CFrame.new(0, 0, -7)*CFrame.Angles(0, math.pi, 0)
end
end
end)
local descToReturn
if pluginUsage ~= "" then
descToReturn = pluginPrefix..pluginName..' '..pluginUsage..'\n'..pluginDescription
else
descToReturn = pluginPrefix..pluginName..'\n'..pluginDescription
end
return pluginName,pluginFunction,pluginLevel,pluginPrefix,{pluginName,pluginUsage,pluginDescription}
end
return Plugin
Here is a update to if no admin comes to get them and they cant call Help command again
you must put a boolvalue in backpack (starterpack) and set it as false and name it “PTS”
local Plugin = function(...)
local Data = {...}
local remoteEvent = Data[1][1]
local remoteFunction = Data[1][2]
local returnPermissions = Data[1][3]
local Commands = Data[1][4]
local Prefix = Data[1][5]
local actionPrefix = Data[1][6]
local returnPlayers = Data[1][7]
local cleanData = Data[1][8]
local pluginName = 'pts'
local pluginPrefix = actionPrefix
local pluginLevel = 0
local pluginUsage = ""
local pluginDescription = "Calls a admin"
local playerService = game:GetService('Players')
local function pluginFunction(Args)
local Player = Args[1]
local Character = Player.Character
local Humanoid = Character and Character:FindFirstChild("Humanoid")
if Player.Backpack.PTS.Value == true then
remoteEvent:FireClient(Player,'Hint','Error','You have already called help.')
end
if Player.Backpack.PTS.Value == false then
Player.Backpack.PTS.Value = true
remoteEvent:FireClient(Player,'Hint','Success','Successfully called help.')
for a,b in next,playerService:GetPlayers() do
local PlayerPermission = returnPermissions(b)
if PlayerPermission > 0 then
remoteEvent:FireClient(b,'Notif','PTS Request','By ' .. Player.Name,{"Support", Player.Name})
end
end
remoteEvent.OnServerEvent:connect(function(Player,Key,...)
local Data = {...}
if Data[1] == "Notification Transfer" then
if Data[2][1] == "Support" then
Player.Backpack.PTS.Value = false
Player.Character.HumanoidRootPart.CFrame = game.Players[Data[2][2]].Character.HumanoidRootPart.CFrame*CFrame.new(0, 0, -5)*CFrame.Angles(0, math.pi, 0)
end
end
end)
end
end
local descToReturn
if pluginUsage ~= "" then
descToReturn = pluginPrefix..pluginName..' '..pluginUsage..'\n'..pluginDescription
else
descToReturn = pluginPrefix..pluginName..'\n'..pluginDescription
end
return pluginName,pluginFunction,pluginLevel,pluginPrefix,{pluginName,pluginUsage,pluginDescription}
end
return Plugin