Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is their any problem with the "nil" in this script?

Asked by 10 years ago

I am making a create your own admin commands script for a group and I need to know if any errors are noticed in this script. I am asking this because every time I run it the script returns an error at "nil".

--[[

create ur commands list here! :)

example.

kill;

--]]

local msg = Instance.new("Hint")

msg.Name = "Message"
msg.Parent = Workspace
msg.Text = "Loading GOODCommands Script made by GoodkidMad"
wait(10)
msg:remove()
end

function PfP(t)
    local Sel = {}
    for i, a in pairs(game.Players:GetChildren()) do
   if string.lower(string.sub(a.Name,1,string.len(t))) == string.lower(t) then
    Sel[#Sel + 1] = a
  end
end
 return Sel
end

player = game.Players["GoodkidMad"]

function commands(t)
     if string.lower(t) == "kill;me" then
  game.Workspace[player.Name].Humanoid.Health = 0
     elseif string.sub(string.lower(t),1,5) == "kill;" then
     for i, a in pairs(PfP(string.sub(string.lower(t),6))) do
     a.Character.Humanoid.Health = 0
     end
 end
end

player.Chatted:connect(commands)

Also if you have any good admin command you would like me to add give me the small script below and or request it as a comment. Thanks for your help!

0
Their is no "nil" so their should be no problems. Hmmm Let me think. GoodkidMad 14 — 10y
0
It would be helpful if you provided the error you were getting. We would be able to help you interpret it. BlueTaslem 18071 — 10y

Answer this question