[V1] Useful GetPlayer Library

Introducing GetPlayer Library V1!

Haven’t created a module in a while (a year to be exact, grinded a solid 18 minutes to make this one). You’re probably wondering… a GetPlayer library? Just keep reading it’ll make sense.

I’m talking :GetPlayerFromAbbreviation() type of functions. Don’t get bored now, keep reading.

I’ve created some pretty useful methods and functions you can use, only 3 in this module so far but I plan on adding more in the near future. Read the documentation and examples below.

Example

For reference, let’s say our test dummy’s name is “Programmer”.

module:GetPlayerFromAbbreviation("pro")
--> Returns 'Programmer' (Instance)
--> Nah, we don't do the case sensitive stuff here.

Documentation

module:GetPlayerFromAbbreviation(abbreviation,includeDisplayNames)
 -- "abbreviation" parameter
	-- Input the abbreviation of the player's name. For example, instead of bobby123, just input "bob". 
		-- Not case sensitive, "Bob" will work aswell.
-- "includeDisplayNames" parameter (optional)
	-- Input includeDisplayNames as true or false. If true, the script will also search for displaynames with "bob" in it.
--RETURNS: Player (Instance) or false



--(Wondering the difference? You can get multiple players with this next function)
module:GetPlayersFromAbbreviation(abbreviation,includeDisplayNames)
-- "abbreviation" parameter
	-- Input the abbreviation of player names, like "bobby" or "bo"
		- Not case sensitive, "Bob" will work aswell.
-- "includeDisplayNames" parameter (optional)
	-- Input includeDisplayNames as true or false. If true, the script will also search for displaynames with "bob" in it.
-- RETURNS: Players (Array) or false




module:GetPlayersInZone(ZonePart)
-- "ZonePart" parameter
	-- Input the Zone (Instance) of the part you want to check if the player is in.
-- RETURNS: Player (Instance) or false

	
Model

Make your life easier
GetPlayer Library - Roblox

Might work on it a little bit more, let me know if you have any suggestions or critiques. Give me all you got, baby. Peace.

7 Likes

I probably wouldn’t use this because if I absolutely had to directly request a certain player, I would want to make sure it’s 100% accurate.

1 Like

that is useful for making custom ban and kick commands actually i like it!

1 Like

I think you’re mistaking the point of the creation of the module.

For example, if you want to make a custom admin script and you’d not want to have to type out the full usernames each time, try this:

local args = msg:split(" ")
if args[1]:lower() == ":kick" then
  if args[2] then
    local target = module:GetPlayerFromAbbreviation(args[2])
    if target then
      --> Do yo magic
    end
  end
end

See what I mean? I get what you mean though.

3 Likes

What about 2 players with similar names?

Ex: BobGuy22 / BobRobert12

Wouldn’t it ban both of them or detect both of them / or one or the other, it’s somewhat unsafe to have bans and stuff from abbreviations.

2 Likes

there isn’t much way to get around that, it probably picks a random one or the one that comes alphabetically first

Nope! GetPlayerFromAbbreviation() returns the first player detected only.

However, GetPlayersFromAbbreviation() returns an array of players.

2 Likes

It does! Check out what I replied to him with.

1 Like

This is actually pretty useful for making admin commands.

it’s already easy to do. Why do you need this module for something thats like 10 lines?

1 Like

I don’t see any use of this whatsoever.

local function ReturnPlayer(Str)
	for i,v in next, Players:GetPlayers() do
		if string.sub(v.Name:lower(),1,string.len(Str)) == Str:lower() then
			return v
		end
	end
end
local function ReturnPlayers(Str)
	local tab = {}
	for i,v in next, Players:GetPlayers() do
		if string.sub(v.Name:lower(),1,string.len(Str)) == Str:lower() then
			table.insert(tab, v)
		end
	end
	return tab
end

This isn’t much of a useful resource.

Scroll up a bit. This would be useful for admin commands.

What do you mean? To make 10 lines… 1 line. :man_facepalming:

10 lines isn’t very much. So theres no need to make something from 10 lines to 1 line.

This isn’t useful at all. It’s literally two functions that anyone can make into their system, why would we need an outside module for it?

1 Like

I guess that’s just your preference. Unlike you, others have said the module was pretty useful, especially for beginners. :man_shrugging:

1 Like

I fail to understand why you continue to say the function is useless when you can take the two seconds to scroll up and see that others found it useful. Of course anyone can integrate into their system, but you can’t even use that argument because all modules can be integrated a different way into someone’s system without actual use of the module. I asked for constructive critcism, not criticism only.

This isn’t useful period. The use of this module can easily be done in 2 functions by anyone, it’s not useful at all.

1 Like

Are you just taking a look at what I’m saying without even reading over it?

May want to rephrase your statement.

One kid with no scripting experience is far from saying this is useful. The sole purpose of your module was made in two functions literally here:

Make something that is useful to the community and not made in 2 minutes for the post count.

1 Like