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

I dont know whats wrong with my Admin script?

Asked by 10 years ago

I am trying to conduct my own Admin Commands script, but the script isn't working, the Output says that 'find' is a nil value, but I dont understand, here is the script;

wait(0)
print("Admin Loaded")
admins={"TheeDeathCaster"}
game:service("Players").PlayerAdded:connect(function(plr)
for i=1,#admins do
if plr.Name:lower()==admins[i]:lower()then
plr.Chatted:connect(function(msg)
if msg:lower():sub(1,5)=="kill/"then
find=game:service("Players"):FindFirstChild(msg:sub(5))
if find~=nil then
find.Character:BreakJoints() --It said the error was here, attempting to call find (a nil value)
print("Killed "..find)
else
print(find.." does not exist")
end end
end)
else
print("nil Player")
end end end)
0
try "if find then" TochiWasHere 10 — 10y
0
I did before I added nil, it said the same thing (attempt to call 'find' a nil value) TheeDeathCaster 2368 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

There is no :service method for DataModel/game. You can do game.Players though or game:GetService("Players").

Ad

Answer this question