I’m trying to create a custom admin, but with a simple command whenever I try to find the player, it returns “nil”. Does anyone know why it’s not returning anything? It registers the print outs of the sender and arguments perfectly.
local commands = {}
local function findPlayer(name)
for i, v in pairs(game.Players:GetChildren()) do
if string.lower(v.Name) == name then
return v
end
end
end
commands.goto = function(sender, arguments)
print(sender)
print(arguments)
local teleportingPlayer = findPlayer(sender)
local teleportingTo = findPlayer(arguments[1])
if teleportingPlayer and teleportingTo then
teleportingPlayer.Character.HumanoidRootPart.CFrame = teleportingTo.Character.HumanoidRootPart.CFrame
print("Teleported")
end
end