Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I dont know whats wrong with my Admin script?

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)

2 comments

0

try "if find then"

0

I did before I added nil, it said the same thing (attempt to call 'find' a nil value)

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.