ExpandPlayers API

Old Post

ExpandPlayers Module

Description

The ExpandPlayers module provides a collection of functions that extend the functionality of the Roblox Players service.

Table of Contents

Functions

GetPlayerByName

function ExpandPlayers:GetPlayerByName(name: string): Player?

Returns the player with the given display name, or nil if no player is found.

Parameters

  • name: string - The display name of the player to look for.

Returns

  • Player? - The player with the given display name, or nil if no player is found.

TeleportPlayer

function ExpandPlayers:TeleportPlayer(player: Player, position: Vector3): void

Teleports the given player to the specified position.

Parameters

  • player: Player - The player to teleport.
  • position: Vector3 - The position to teleport the player to.

Returns

  • void

GetPlayerByUserId

function ExpandPlayers:GetPlayerByUserId(userId: number): Player?

Returns the player with the given UserId, or nil if no player is found.

Parameters

  • userId: number - The UserId of the player to look for.

Returns

  • Player? - The player with the given UserId, or nil if no player is found.

GetPing

function ExpandPlayers:GetPing(player: Player): number

Returns the ping of the given player, or 0 if the ping cannot be found.

Parameters

  • player: Player - The player to get the ping of.

Returns

  • number - The ping of the given player, or 0 if the ping cannot be found.

GetFPS

function ExpandPlayers:GetFPS(player: Player): number

Returns the FPS of the given player, or 0 if the FPS cannot be found.

Parameters

  • player: Player - The player to get the FPS of.

Returns

  • number - The FPS of the given player, or 0 if the FPS cannot be found.

GetResolution

function ExpandPlayers:GetResolution(player: Player): Vector2

Returns the GUI resolution of the given player, or Vector2.new(0, 0) if the resolution cannot be found.

Parameters

  • player: Player - The player to get the GUI resolution of.

Returns

  • Vector2 - The GUI resolution of the given player, or Vector2.new(0, 0) if the resolution cannot be found.

SetWalkspeed

function ExpandPlayers:SetWalkspeed(player: Player, speed: number)

Sets the walkspeed of the given player.

Parameters

  • player: Player - The player to set the walkspeed of.
  • speed: number - The new walkspeed.

Returns

  • void

SetJumpPower

function ExpandPlayers:SetJumpPower(player: Player, power: number)

Sets the jump power of the given player.

Parameters

  • player: Player - The player to set the jump power of.
  • power: number - The new jump power.

Returns

  • void

CreateBackpack

function ExpandPlayers:CreateBackpack(player: Player)

Creates a new backpack for the given player.

Parameters

  • player: Player - The player to create the backpack for.

Returns

  • void

CreateFolder

function ExpandPlayers:CreateFolder(player: Player, folderName: string)

Creates a new folder in the given player’s backpack.

Parameters

  • player: Player - The player to create the folder for.
  • folderName: string - The name of the new folder.

Returns

  • void

GetResolution

function ExpandPlayers:GetResolution(player: Player): Vector2

Returns the GUI resolution of the given player, or Vector2.new(0, 0) if the resolution cannot be found.

Parameters

  • player: Player - The player to get the GUI resolution of.

Returns

  • Vector2 - The GUI resolution of the given player, or Vector2.new(0, 0) if the resolution cannot be found.

SetWalkspeed

function ExpandPlayers:SetWalkspeed(player: Player, speed: number)

Sets the walkspeed of the given player.

Parameters

  • player: Player - The player to set the walkspeed of.
  • speed: number - The new walkspeed.

Returns

  • void

SetJumpPower

function ExpandPlayers:SetJumpPower(player: Player, power: number)

Sets the jump power of the given player.

Parameters

  • player: Player - The player to set the jump power of.
  • power: number - The new jump power.

Returns

  • void

GetCurrentTool

function ExpandPlayers:GetCurrentTool(player: Player): Tool?

Returns the current tool equipped by the player, or nil if the player has no tool equipped.

Parameters

  • player: Player - The player to get the current tool of.

Returns

  • Tool? - The current tool equipped by the player, or nil if the player has no tool equipped.

UnequipCurrentTool

function ExpandPlayers:UnequipCurrentTool(player: Player): void

Unequips the current tool of the player.

Parameters

  • player: Player - The player to unequip the tool of.

Returns

  • void

EquipTool

function ExpandPlayers:EquipTool(player: Player, tool: Tool): void

Equips the given tool to the player.

Parameters

  • player: Player - The player to equip the tool to.
  • tool: Tool - The tool to equip.

Returns

  • void

CreateBackpackFolder

function ExpandPlayers:CreateBackpackFolder(player: Player, folderName: string): Folder?

Creates a new folder in the player’s backpack and returns it.

Parameters

  • player: Player - The player to create the folder for.
  • folderName: string - The name of the new folder.

Returns

  • Folder? - The new folder created.

ClearBackpack

function ExpandPlayers:ClearBackpack(player: Player): void

Removes all tools and items from the player’s backpack.

Parameters

  • player: Player - The player whose backpack will be cleared.

Returns

  • void

SetTeam

function ExpandPlayers:SetTeam(player: Player, team: Team): void

Sets the team of the given player.

Parameters

  • player: Player - The player to set the team of.
  • team: Team - The new team.

Returns

  • void

GetGamepasses

function ExpandPlayers:GetGamepasses(player: Player): Array<GamepassInfo>

Returns an array of GamepassInfo objects representing the gamepasses owned by the player.

Parameters

  • player: Player - The player to get the gamepasses of.

Returns

  • Array<GamepassInfo> - An array of GamepassInfo objects representing the gamepasses owned by the player.

HasGamepass

function ExpandPlayers:HasGamepass(player: Player, gamepassId: number): boolean

Returns true if the player owns the gamepass with the given ID, false otherwise.

Parameters

  • player: Player - The player to check for gamepass ownership.
  • gamepassId: number - The ID of the gamepass to check for.

Returns

  • boolean - true if the player owns the gamepass with the given ID, false otherwise.

GetGamepasses

function ExpandPlayers:GetGamepasses(player: Player): Array<GamepassInfo>

Returns an array of GamepassInfo objects representing the gamepasses owned by the player.

Parameters

  • player: Player - The player to get the gamepasses of.

Returns

  • Array<GamepassInfo> - An array of GamepassInfo objects representing the gamepasses owned by the player.

HasPlayedGameBefore

function ExpandPlayers:HasPlayedGameBefore(player: Player): boolean

Returns true if the player has played the game before, otherwise it’ll return false.

Parameters

  • player: Player - The player to check for if they’ve played the game before.

Returns

  • boolean - true if the player has played the game before, else false.

GetLocalPlayerFormattedTime

function ExpandPlayers:GetLocalPlayerFormattedTime()

Returns the player’s LocalPlayer’s Time Fortmatted.

This function can only be used in LocalScripts.

Parameters

Returns


Download

Releases · DecentAgent/ExpandedPlayers · GitHub

ExampleScript.lua (817 Bytes): An example script placed in ServerScriptService. Chat commands using ExpandedPlayers


Please let me know how ExpandedPlayers might be made better in the future!

16/05/2023 - 21:54 CEST || UPDATE


I hope this message finds you well. I regret to inform you that the project I had been working on has been officially cancelled and subsequently shut down. This decision was made primarily in response to the influx of numerous hate comments and the prevailing perception that the project was being perceived as spam. As someone who values the integrity and cleanliness of this forum, I have ultimately decided to discontinue further updates on this project.

I must acknowledge that in retrospect, the initiation of this endeavour was ill-conceived, and I take full responsibility for the misjudgement in creating it. Recognizing the importance of maintaining a positive and constructive environment within this community, I have chosen to prioritize the preservation of the forum’s reputation and the satisfaction of its members.

Should any of you have any inquiries or require further clarification, please do not hesitate to contact me directly. I am more than willing to address any concerns or questions you may have. Once again, I apologize for any inconvenience caused, and I am grateful for your understanding and support.

Sincerely,

DecentAgent

13 Likes

Cool resource, but most of the functions can easily be replicated with just 1 line of code. I suggest you add more useful functions such as BanPlayer() or GetLocalPlayerFormattedTime(). I also recommend that instead of a modular function approach, you use OOP to return a wrapped instance of the Player which contains the regular methods as well as your own.

3 Likes

Cool resource. Is there going to be a GetDevice function?

3 Likes

Hmm…great resource though, but most of the functions are just available as Roblox API, and some things are just made using 2-3 lines of code, but keep going and continue your great work! Looking forward for more modules! :smiley:

1 Like

Nice resource!

I definetly think this could be useful, for things like anti-cheats; It could combat false positives, like laggy players getting falsely flagged for changing their walkspeed. (I especially think the FPS function would be useful there.)

Although, like many others said, many of these functions could be replicated with a few lines, I personally think Module:ExecuteFunction() looks nicer than just regular code. It also cleans the code up, even just a little.

Overall, very nice job!

1 Like

Yeah, that’ll be future updates. I have right now added that to the todo list! :happy1:

How would it function? Consider what it might be able to access as ROBLOX has various restrictions. So that nobody gets into difficulty, I can try to gather as much *“information on a legal level” as I can!

Nice resource but, some functions already exist like ExpandPlayers:HasGamepass is literally just MS:UserOwnsGamePassAsync.

You should add some more unique things like ExpandPlayers:GetPlayerHeight or ExpandPlayers:HasPlayedGameBefore if you can.

(All of these functions can be scripted with normal Lua but good job)

Basically, I just want to make ExpandedPlayers a little bit simpler to use by integrating some features that were previously in ROBLOX’s Players service. I’ll also probably make some changes to HasGamepass. Yes, I can include those two you suggested.

1 Like

ExpandedPlayers Trello & GitHub


You may examine changes and plans on our Trello board, where you can also possibly see your own suggestions. :flushed: - you can visit it at Trello

Also, view our GitHub: Release V.0.1 · DecentAgent/ExpandedPlayers · GitHub

1 Like

Alright great!
Also you could add some functions that simply cut long lines, if you understand what I mean.

1 Like

No, I do not unfortunately know what you mean lol.

1 Like

I’ll give you an example:

Instead of this

local dss = game:getservice("DataStoreService")
local data = dss:getdatastore("hi")

save = function(player, key)
   local s, e = pcall(function()
      data:setasync(key, player.data.value)
   end
   if s then
      print("yay")
   else
      warn(e)
   end
end

game.Players.PlayerAdded:Connect(function(p) save(p, p.UserId.."-aaa")

Do this

return ExpandPlayers:SaveData(player:Player, key,:string dataStore:GlobalDataStore) -- returns success or error
1 Like

Oh, you mean like that. I have a DataStoreService I created called QuadaStore. I might add it.

1 Like

Minor Update (V.0.1.5)

Added

HasPlayedGameBefore

function ExpandPlayers:HasPlayedGameBefore(player: Player): boolean

Returns true if the player has played the game before, otherwise it’ll return false.

Parameters

  • player: Player - The player to check for if they’ve played the game before.

Returns

  • boolean - true if the player has played the game before, else false.

GetLocalPlayerFormattedTime

function ExpandPlayers:GetLocalPlayerFormattedTime()

Returns the player’s LocalPlayer’s Time Fortmatted.

This function can only be used in LocalScripts.

Parameters

Returns


Removed

  • Useless lines

Revamped

  • HasGamepass()

We appreciate all of your suggestions. I attempt to make ExpandPlayers/ExpandedPlayers, whatever you want to call it as excellent as possible. So that you can truly have a use case for this, I welcome any thoughts you may have.

1 Like

I’m not great with identifying the device type an user is using, but these functions would help:

UserInputService
https://create.roblox.com/docs/reference/engine/classes/UserInputService#KeyboardEnabled

https://create.roblox.com/docs/reference/engine/classes/UserInputService#MouseEnabled

https://create.roblox.com/docs/reference/engine/classes/UserInputService#GyroscopeEnabled

https://create.roblox.com/docs/reference/engine/classes/UserInputService#GamepadEnabled

https://create.roblox.com/docs/reference/engine/classes/UserInputService#AccelerometerEnabled

https://create.roblox.com/docs/reference/engine/classes/UserInputService#TouchEnabled

GuiService

Thank you! I might be able to mix something up within it all. :smiley:

Good library, but it has some issues needs to be fixed.


You can checkout and configure this module to fit your needs. This one contains several criteria to determine device type based on scores.

1 Like

ExpandedPlayers GitHub


You can now issue pull requests on our GitHub: ExpandedPlayers/ExpandedPlayers.lua at main · DecentAgent/ExpandedPlayers · GitHub