I am trying to make a whois command where it will show the player information even if the player isn’t in game. So far the command only works if the player is in game;
however, I want it to find the player even if they are not in the game. When i search someone with using their ID, it always returns with a error;
Script:
local UserIDSplit = tonumber(split[2])
if UserIDSplit then
local SearchedPlayer = Players:GetPlayerByUserId(UserIDSplit)
print("Found: " .. SearchedPlayer.Name)
print("Account Age: " .. SearchedPlayer.AccountAge .. " days old")
if DeveloperModule.isDeveloper(localPlayer.Name) then
print(SearchedPlayer.Name .. " Is a developer")
end
local Ingame = game.Workspace:FindFirstChild(SearchedPlayer.Name)
if Ingame then
print("Currently in game")
else
print("Not in game server")
end
else
CommandInputBox.TextColor3 = Color3.fromRGB(255, 124, 124)
CommandInputBox.Text = "You must input the player's user ID instead."
task.wait(4)
CommandInputBox.TextColor3 = Color3.fromRGB(255, 255, 255)
CommandInputBox.Text = ""
end
end
If you know, how to fix this. That would be great. Thanks