local admins = {"JuzeyPlayz","Player1"}
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
for i, v in pairs(admins) do
if player.Name == v then
-- List of commands
-- kill cmd
if string.sub(message:lower(), 1, 8) == ";kill me" then
player.Character.Humanoid.Health = 0
elseif string.sub(message:lower(), 1, 12) == ";kill others" then
for i,v in pairs(game.Players:GetPlayers()) do
if v.Name ~= player.Name then
v.Character.Humanoid.Health = 0
end
end
elseif string.sub(message:lower(), 1, 9) == ";kill all" then
for i,v in pairs (game.Players:GetPlayers()) do
v.Character.Humanoid.Health = 0
end
elseif string.sub(message:lower(), 1, 5) == ";kill" then
local fiPlayer = string.sub(message:lower(), 7)
for _, v in pairs(game.Players:GetPlayers()) do
if string.sub(v.Name:lower(), 1, #fiPlayer) == fiPlayer then
v.Character.Humanoid.Health = 0
end
end
end
-- tp cmds
local cmd, args = nil, {}
for argmatch in message:gmatch("[%w%p]+") do
if cmd == nil then
cmd = argmatch:lower()
else
table.insert(args, argmatch:lower())
end
end
if cmd == ";tp" then
local Player1 = {}
if args[1] == "me" then
table.insert(Player1, player)
elseif args[1] == "others" then
for i,v in pairs(game.Players:GetPlayers()) do
if v.Name ~= player.Name then
table.insert(Player1, v)
end
end
else
for _, v in pairs(game.Players:GetPlayers()) do
if string.sub(v.Name:lower(), 1, #args[1]) == args[1] then
table.insert(Player1, v)
end
end
end
local Player2;
if args[2] == "me" then
Player2 = player
else
for _, v in pairs(game.Players:GetPlayers()) do
if string.sub(v.Name:lower(), 1, #args[2]) == args[2] then
Player2 = v
end
end
end
if #Player1 == 0 or Player2 == nil then
return "[Admin] Error: Argument 1 (or 2) is invalid."
end
for _, v in pairs(Player1) do
v.Character.Humanoid.Jump = true
v.Character:SetPrimaryPartCFrame(Player2.Character.HumanoidRootPart.CFrame)
end
end
end
end
end
end) -- Error is right there!
end)
I am having an error line under the 2nd to last end) How do I fix this? (ADVANCE)
1 answer
The problem may be that you didn't close the end at line 5 and line 6 try this if it didn't work tell me
local admins = {"JuzeyPlayz","Player1"}
game.Players.PlayerAdded:Connect(function(player)
end)
player.Chatted:Connect(function(message)
end)
for i, v in pairs(admins) do
end
if player.Name == v then
-- List of commands
-- kill cmd
end
if string.sub(message:lower(), 1, 8) == ";kill me" then
player.Character.Humanoid.Health = 0
elseif string.sub(message:lower(), 1, 12) == ";kill others" then
for i,v in pairs(game.Players:GetPlayers()) do
if v.Name ~= player.Name then
v.Character.Humanoid.Health = 0
end
end
elseif string.sub(message:lower(), 1, 9) == ";kill all" then
for i,v in pairs (game.Players:GetPlayers()) do
v.Character.Humanoid.Health = 0
end
elseif string.sub(message:lower(), 1, 5) == ";kill" then
local fiPlayer = string.sub(message:lower(), 7)
for _, v in pairs(game.Players:GetPlayers()) do
if string.sub(v.Name:lower(), 1, #fiPlayer) == fiPlayer then
v.Character.Humanoid.Health = 0
end
end
end
-- tp cmds
local cmd, args = nil, {}
for argmatch in message:gmatch("[%w%p]+") do
if cmd == nil then
cmd = argmatch:lower()
else
table.insert(args, argmatch:lower())
end
end
if cmd == ";tp" then
local Player1 = {}
if args[1] == "me" then
table.insert(Player1, player)
elseif args[1] == "others" then
for i,v in pairs(game.Players:GetPlayers()) do
if v.Name ~= player.Name then
table.insert(Player1, v)
end
end
else
for _, v in pairs(game.Players:GetPlayers()) do
if string.sub(v.Name:lower(), 1, #args[1]) == args[1] then
table.insert(Player1, v)
end
end
end
local Player2;
if args[2] == "me" then
Player2 = player
else
for _, v in pairs(game.Players:GetPlayers()) do
if string.sub(v.Name:lower(), 1, #args[2]) == args[2] then
Player2 = v
end
end
end
if #Player1 == 0 or Player2 == nil then
return "[Admin] Error: Argument 1 (or 2) is invalid."
end
for _, v in pairs(Player1) do
v.Character.Humanoid.Jump = true
v.Character:SetPrimaryPartCFrame(Player2.Character.HumanoidRootPart.CFrame)
end
end
5 comments
Sorry but this did not work there was a line under all the Player scripts but when I added an end) to the last one they went away but then there was a red line sorry but overall it did not work
@JesseSong
Try deleting the end with the red line
@JesseSong I did it just didn't work :/ Its a video I am watching to make this and its taking me all day here is link to vid if you want to write it yourself and help me https://www.youtube.com/watch?v=XgS0LUoqM1Q&t=473s
@JesseSong I did it just didn't work :/ Its a video I am watching to make this and its taking me all day here is link to vid if you want to write it yourself and help me https://www.youtube.com/watch?v=XgS0LUoqM1Q&t=473s
This discussion is preserved as it was. New answers, comments, and votes are closed.

12 comments
This is an admin script btw
The error line is 156 in the Output it says Error:(155,5)Expected')'(to close'('at line 6),got'end'
@Nguyenlegiahung did that help?
So you know how to fix it? @Nguyenlegiahung
At what line?
? May you copy and paste the script and add what your saying?
Also there is no line 165 dude
There is no Line 164!!! what do you mean!
Nope did not work now there is a line under the last end r u trolling me?
No i am doing what the output said
Close the conditional statement at line 5.
@JesseSong please write it out I am not that good copy and paste and fix it so I can see Please if you could.