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

Admin script Other's isn't working?

Asked by
SimIcy 5
10 years ago
ROOT_OS={
Players=game:GetService("Players")
}
---Sim Stoof

--AdminFind

--Findplyr
playerSearch=function(text,player) --Returns a table of the players
local stringk=text:lower()
if stringk=="me" then --Return a table with just 1 players, the one that called the function.
return {player}
elseif stringk == "all" then --Return a table with all current players, effectively the GetPlayers method.
return ROOT_OS.Players:GetPlayers()
elseif stringk=="others" then
local plyrsz = {}
for j, v in pairs(ROOT_OS.Players:GetPlayers()) do
if v ~= text then
table.insert(plyrsz,v)
end
end
--You can add more elseifs for other cases. The last else matches everything else.
else --Check for players that match text
local plyrs = {} --Players will be added to here and returned once all players are checked.
for j, v in pairs(ROOT_OS.Players:GetPlayers()) do --Loop through all players.
if #v.Name >= #text and v.Name:lower():sub(1,#text) == text:lower() then
--Above line: if The name is the length of, or bigger than thel ength of the search text then: if the lowercase version of the name, subtracted to the first to [the length of search text]th characters is equal to the lowercase of the searhc text, then
--The second part of the above line is a simple way to check if the start of a search text is the same as other text. There's more complicated versions using things liek string patterns. http://wiki.roblox.com/index.php?title=Patterns is you're interested.
table.insert(plyrs,v) --Add player to list
end
end
return plyrs --Return list
end
end






I put at much detail as possible

1 answer

Log in to vote
1
Answered by 10 years ago
if v ~= text then

should be:

if v ~= player then
Ad

Answer this question