Hello, I'm currently making a admin for my game, and I'm having errors. Error: Players.lightt_1337.PlayerGui.MainModule.Admin.Bar.TextBox.LocalScript:81: attempt to call a nil value Stack Begin 14:16:57.113 - Script 'Players.lightt_1337.PlayerGui.MainModule.Admin.Bar.TextBox.LocalScript', Line 81 14:16:57.114 - Stack End
As you can see its calling a error on the local script.
My script:
local UIS = game:GetService("UserInputService")
local function getplayers(t)
local tablofplr = {}
if t == "all" then
for i,v in pairs(game.Players:GetPlayers()) do
table.insert(tablofplr, v)
end
elseif t == "others" then
for i,v in pairs(game.Players:GetPlayers()) do
table.insert(tablofplr, v)
end
for i,v in pairs(tablofplr) do
if v == game.Players.LocalPlayer then
table.remove(tablofplr, i)
end
end
elseif t == "me" then
table.insert(tablofplr, game.Players.LocalPlayer)
else
if string.split(t, "|")[2] then
for i,v in pairs(string.split(t, "|")) do
for _, plr in pairs(game.Players:GetPlayers()) do
if plr.Name:lower():find(v:lower()) then
table.insert(tablofplr, plr)
end
end
end
else
for _, plr in pairs(game.Players:GetPlayers()) do
if plr.Name:lower():find(t:lower()) then
table.insert(tablofplr, plr)
end
end
end
end
return tablofplr
end
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Semicolon then
script.Parent.Parent:TweenPosition(UDim2.new(0.204, 0, 0.929, 0), "In", "Sine", 0.3)
script.Parent:CaptureFocus()
wait(0.1)
script.Parent.Text = ""
end
end)
script.Parent.FocusLost:Connect(function(enterPressed)
if enterPressed then
script.Parent.Parent:TweenPosition(UDim2.new(-0.592, 0, 0.95, 0), "Out", "Sine", 0.3)
local argstosend
if string.split(script.Parent.Text, " ")[2] == nil then
argstosend = {
["cmd"] = string.split(script.Parent.Text, " ")[1],
["targets"] = getplayers("me"),
["me"] = game.Players.LocalPlayer,
["args"] = string.split(script.Parent.Text, " ")
}
else
argstosend = {
["cmd"] = string.split(script.Parent.Text, " ")[1],
["targets"] = getplayers(string.split(script.Parent.Text, " ")[2]),
["me"] = game.Players.LocalPlayer,
["args"] = string.split(script.Parent.Text, " ")
}
end
require(script.Parent.handler).runcmd(argstosend)
script.Parent.Text = ""
end
end)
script.Parent.Changed:Connect(function()
for _,b in pairs(script.Parent.Parent.Frame:GetChildren()) do
if b:IsA("Frame") then
b:Destroy()
end
end
if script.Parent.Text ~= ""then
for i,v in pairs(require(script.Parent.handler).getcmds()) do
if v["cmd"] ~= nil and v["cmd"]:find(script.Parent.Text) or v["cmd"]:find(string.split(script.Parent.Text, " ")[1]) then
local b = script.Parent.Parent.CMDName:Clone()
b.Parent = script.Parent.Parent.Frame
b.Visible = true
b:FindFirstChild("TextLabel").Text = v["desc"]
end
end
end
end)
