Player Wrapper
SimpleAdmin uses a custom player wrapper to promote clean code. It allows us to add custom functions, methods, and properties to the player. This wrapper is used a lot throughout the system and makes a lot of tasks really easy.
Retrieving the wrapper
local Wrapper = Service.PlayerWrapper(game.Players.crywink)
This wrapper is cached when it's first created, so you can also compare wrappers to see if they're from the same player.
Properties
Property
Description
Data
Wrapper.Data
is a table that you can use to store player-specific data. It's automatically saved to our DataStore when the player leaves the game.
Temp
Wrapper.Temp
is a table that is wiped when the player leaves the game or the server shuts down. It allows you to store temporary data.
Ping
The player's approximate ping.
PingSent
The epoch time when the request to retrieve the player's ping was sent.
IsWindowFocused
Whether or not the player is focused on the Roblox window.
_Object
The player's real player instance.
GetLevel
local Wrapper = Service.PlayerWrapper(game.Players.crywink)
local PermissionLevel = Wrapper.GetLevel()
print(PermissionLevel)
This will retrieve the player's cached permission level. If it hasn't been retrieved yet, it will be grabbed from the DataStore.
GetHumanoid
local Wrapper = Service.PlayerWrapper(game.Players.crywink)
local Humanoid = Wrapper.GetHumanoid()
Humanoid:TakeDamage(10)
Returns the player's Humanoid.
Send
local Wrapper = Service.PlayerWrapper(game.Players.crywink)
Wrapper.Send("Message", "Hey, this is a test!", 5)
Fires a RemoteEvent via the SimpleAdmin network module.
Ban
local Wrapper = Service.PlayerWrapper(game.Players.crywink)
Wrapper.Ban("ROBLOX", "Exploiting") -- Moderator, Reason
Bans the player from the game.
Last updated
Was this helpful?