| -- Objects | |
| -- AbilityConfig | |
| Description: Used to define the properties of an ability | |
| Parameters | |
| maxProgress: number | |
| The maximum amount of progress that can be stored on the ability. | |
| progressPerUse: number | |
| The amount of progress used every time the ability is activated. | |
| iconImage: string | nil | |
| An optional rbxassetid of the image that will be shown on the button for the ability. | |
| -- Here is a script that uses this object: | |
| Events.UseAbility(function (event) | |
| if (event.abilityName == "yeehaw") then | |
| AnnouncementService.sendAnnouncement("YEEHAW!") | |
| end | |
| end) | |
| -- Create a "yeehaw" ability that is activated with the X key | |
| -- The ability has 2 stacks of "yeehaw" | |
| local abilityConfig = { | |
| maxProgress = 10, | |
| progressPerUse = 5 | |
| iconImage = "rbxassetid://7193644599" | |
| } | |
| AbilityService.createAbility("yeehaw", KeyCode.X, abilityConfig) | |
| -- Add the ability to the host | |
| AbilityService.enableAbility(MatchService.getHost(), "yeehaw") | |
| -- Block | |
| Description: A reference to a block in the world. | |
| Parameters | |
| blockType: ItemType | |
| The type of block. | |
| position: Vector3 | |
| Where the block is located. | |
| placedByUserId: number | nil | |
| The Roblox user ID of the player who placed the block (may not exist if placed by the server). | |
| -- Entity | |
| Description: An Entity is anything that can take damage (player, pengin, skeleton, etc). | |
| Functions | |
| getPlayer(): Player | nil | |
| Returns the player playing as this entity. If this entity is an NPC (like a Creature) this will return nil. | |
| getHealth(): number | |
| Returns current health of the entity. | |
| getMaxHealth(): number | |
| Returns max health of the entity. | |
| isAlive(): bool | |
| Returns true if the entity is alive. | |
| getPosition(): Vector3 | nil | |
| Returns the current position of the entity. | |
| setPosition(position: Vector3) | |
| Sets the position of the entity. | |
| -- Example usage: | |
| Events.BlockPlace(function(event) | |
| local entity = event.player:getEntity() | |
| if not entity then | |
| return | |
| end | |
| entity:setPosition(event.position + Vector3.new(0,3,0)) | |
| end) | |
| getCFrame(): CFrame | nil | |
| Returns the current CFrame of the entity. | |
| setCFrame(cframe: CFrame) | |
| Sets the CFrame of the entity. | |
| setMaxHealth(health: number) | |
| Sets the max health of the entity. | |
| setCustomName(name: string): nil | |
| Sets a custom display name on the entity's healthbar. | |
| destroy() | |
| Destroys the entity. | |
| -- ImageEntity | |
| Description: Extends Entity (includes all the functions and parameters of Entity) | |
| Parameters | |
| image: string | |
| The rbxassetid of the image used to create the image entity. | |
| Functions | |
| moveTo(position: Vector3): nil | |
| Moves the entity to the specified position. | |
| attack(target: Entity, damage: number): boolean | |
| The entity attacks the target Entity for the specified damage amount. Returns true if the attack was successful. | |
| setSpeed(speed: number) | |
| Sets the walk speed of the entity. | |
| getModel(): Model | nil | |
| Returns the Model of the entity. | |
| -- KitEntity | |
| Description: Extends Entity (includes all the functions and parameters of Entity) | |
| Parameters | |
| kitType: KitType | |
| Which type of Kit the entity is. | |
| Functions | |
| moveTo(position: Vector3): nil | |
| Moves the entity to the specified position. | |
| attack(target: Entity, damage: number): boolean | |
| The entity attacks the target Entity for the specified damage amount. Returns true if the attack was successful. | |
| setSpeed(speed: number) | |
| Sets the walk speed of the entity. | |
| setArmor(armor: ItemType) | |
| Sets armor of the entity. | |
| --Examples: ItemType.LEATHER_HELMET, ItemType.IRON_HELMET, ITEM_TYPE.DIAMOND_HELMET | |
| setHandItem(item: ItemType) | |
| Sets the item held in the hand of the entity. | |
| getModel(): Model | nil | |
| Returns the Model of the entity. | |
| -- CreatureEntity | |
| Description: Extends Entity (includes all the functions and parameters of Entity) | |
| Parameters | |
| creatureType: CreatureType | |
| Which type of Creature the entity is. | |
| team: Team | |
| Which team is allied with the Creature. Friendly Creatures, such as Skeletons or Ducks, will attack all other teams. Hostile Creatures, such as Void Crabs, will always attack all teams. | |
| Functions | |
| moveTo(position: Vector3): nil | |
| Moves the Creature to the specified position. | |
| attack(target: Entity, damage: number): boolean | |
| Creature attacks the target Entity for the specified damage amount. Returns true if the attack was successful. | |
| setSpeed(speed: number) | |
| Sets the walk speed of the Creature. | |
| getModel(): Model | nil | |
| Returns the Model of the entity. | |
| -- Generator | |
| Description: Automatically drops an item on an interval (cooldown). | |
| Functions | |
| setCooldown(cooldown: number) | |
| Sets the cooldown of the generator (in seconds). This is how many seconds passes in-between item drops. Defaults to 20 seconds. | |
| setItem(itemType: ItemType) | |
| Sets the type of item that is dropped by the generator. | |
| setMax(max: number) | |
| Sets the max stack size that the generator can hold. Once the max stack size is reached, no more items will be generated until the items are picked up. Defaults to 10. | |
| setPosition(position: Vector3) | |
| Sets the position of the generator. | |
| getPosition(): Vector3 | |
| Returns the position of the generator. | |
| dropItem(itemType: ItemType) | |
| Immediately drops an item from the generator. | |
| destroy() | |
| Destroys the generator. | |
| -- Knockback | |
| Parameters | |
| fromPosition: Vector3 | |
| The position from which knockback should be applied. If this is equal to the position of the hit entity, no knockback will be applied. | |
| horizontal: number | nil | |
| The amount of horizontal knockback applied. Defaults to 1. A value of 0 will apply no horizontal knockback. | |
| vertical: number | nil | |
| The amount of vertical knockback applied. Defaults to 1. A value of 0 will apply no vertical knockback. | |
| -- Example usage: | |
| -- All damage events launch the hit entity into the air with no damage | |
| Events.EntityDamage(function(event) | |
| event.damage = 0 | |
| event.knockback.horizontal = 0.5 | |
| event.knockback.vertical = 5 | |
| event.knockback.fromPosition = event.entity:getPosition() - Vector3.new(0,3,0) | |
| end) | |
| -- Another Example | |
| -- Cancels knockback for all damage events | |
| Events.EntityDamage(function(event) | |
| event.knockback.horizontal = 0 | |
| event.knockback.vertical = 0 | |
| end) | |
| -- Leaderboard | |
| Description: A leaderboard shown on a player's HUD | |
| For examples on how to use, refer to UIService. | |
| A leaderboard consists of entries (the rows displayed on the UI). Each entry has a key and a score associated with it. | |
| Keys refer to the names of what is being ranked on the leaderboard. You can add Players, Teams, or words (strings) to the leaderboard. | |
| Scores are the number displayed next to each key. The leaderboard entries are automatically ordered by descending scores. The rank of a key is its place. | |
| Functions | |
| getKeys(): Array<Player | Team | string> | |
| Returns the keys of the leaderboard. | |
| addKey(key: Player | Team | string, initialScore: number | nil) | |
| Adds a new key to the leaderboard of the given type. You can optionally give the key an initial score, which otherwise defaults to zero. | |
| removeKey(key: Player | Team | string) | |
| Removes the key from the leaderboard. | |
| addScore(key: Player | Team | string, amount: number) | |
| Adds the given amount to the current score of the key. | |
| subScore(key: Player | Team | string, amount: number) | |
| Subtracts the given amount from the current score of the key. | |
| setScore(key: Player | Team | string, amount: number) | |
| Sets the score of the key to the given amount. | |
| getScore(key: Player | Team | string): number | nil | |
| Returns the current score of the key. Returns nil if the key is not part of the leaderboard. | |
| getPlace(place: number): Player | Team | string | nil | |
| Returns the key located at the place. Returns nil if there is no key at the place. | |
| clear() | |
| Clears all leaderboard entries. | |
| -- MatchState | |
| Description: Object describing the different match states | |
| PRE = 0, | |
| RUNNING = 1, | |
| POST = 2, | |
| -- Model | |
| Description: For examples on how to use, check ModelService. | |
| Parameters | |
| modelName: ModelType | |
| Name of the model to be imported | |
| Functions | |
| setPosition(position: Vector3) | |
| Sets the position of the model. | |
| getPosition(): Vector3 | |
| Returns the position of the model. | |
| setRotation(rotation: Vector3) | |
| Sets the rotation of the model. | |
| getRotation(): Vector3 | |
| Returns the rotation of the model. | |
| setCFrame(cframe: CFrame) | |
| Sets the CFrame of the model to the specified CFrame. | |
| getCFrame(): CFrame | |
| Returns the CFrame of the model. | |
| setScale(scale: number) | |
| Sets the scale of the model. | |
| getScale(): number | |
| Returns the scale of the model. | |
| setCollidable(collidable: boolean) | |
| Sets whether the model should collide with other models, blocks, and players. Defaults to true on creation. | |
| setAnchored(anchored: boolean) | |
| Sets whether the model should have physics applied to it. Defaults to true on creation. | |
| setTransparency(transparency: number) | |
| Sets the transparency of the model. Transparency ranges from 0 (opaque) to 1 (invisible). | |
| destroy() | |
| Destroys the model. | |
| -- ParticleEmitter | |
| For examples on how to use, refer to ParticleService. | |
| Creates a Roblox ParticleEmitter. | |
| Functions | |
| setTexture(texture: string) | |
| Sets the rbxassetid of the texture of the particle emitter. | |
| setColor(color: ColorSequence) | |
| Sets the color of the particles emitted. | |
| setRate(rate: number) | |
| Sets the rate of the particles emitted. | |
| setPosition(position: Vector3) | |
| Sets the position of the particle emitter. | |
| getPosition(): Vector3 | |
| Returns the position of the particle emitter. | |
| setRotation(rotation: Vector3) | |
| Sets the rotation of the particle emitter. | |
| getRotation(): Vector3 | |
| Returns the rotation of the particle emitter. | |
| setCFrame(cframe: CFrame) | |
| Sets the CFrame of the particle emitter. | |
| getCFrame(): CFrame | |
| Returns the CFrame of the particle emitter. | |
| setRegionSize(size: Vector3) | |
| Sets the size of the region from which particles are emitted. | |
| getRegionSize(): Vector3 | |
| Returns the size of the region from which particles are emitted. | |
| setSize(size: NumberSequence) | |
| Sets the size of the particles emitted. | |
| getSize(): NumberSequence | |
| Returns the size of the particles emitted. | |
| setTransparency(transparency: NumberSequence) | |
| Sets the transparency of the particles emitted. | |
| getTransparency(): NumberSequence | |
| Returns the transparency of the particles emitted. | |
| setBrightness(brightness: number) | |
| Sets the brightness of the particles emitted. | |
| setSpeed(speed: NumberRange) | |
| Sets the speed of the particles emitted. | |
| setAcceleration(acceleration: Vector3) | |
| Sets the acceleration of the particles emitted. | |
| setDrag(drag: number) | |
| Sets the drag of the particles emitted. | |
| setLifetime(lifetime: NumberRange) | |
| Sets the lifetime of the particles emitted. | |
| setParticleOrientation(orientation: ParticleOrientation) | |
| Sets the particle orientation of the particles emitted. Written as ParticleOrientation.FacingCamera | |
| setParticleRotation(rotation: NumberRange) | |
| Sets the particle rotation of the particles emitted. | |
| setRotSpeed(speed: NumberRange) | |
| Sets the rotation speed of the particles emitted. | |
| setLightInfluence(influence: number) | |
| Sets the light influence of the particles emitted. | |
| setLightEmission(emission: number) | |
| Sets the light emission of the particles emitted. | |
| setSquash(squash: NumberSequence) | |
| Sets the squash of the particles emitted. | |
| setSpreadAngle(angle: Vector2) | |
| Sets the spread angle of the particles emitted. | |
| setTimeScale(timeScale: number) | |
| Sets the time scale of the particles emitted. | |
| setEnabled(enabled: boolean) | |
| Enables or disables the particle emitter. | |
| setLockedToPart(locked: boolean) | |
| Sets the particle emission to be locked to the emission source, or whether the particles will linger around the position they were emitted if the emission source moves. | |
| emit(amount: number | nil) | |
| Emits the given amount of particles, otherwise defaults to the rate of the particle emitter. | |
| clear() | |
| Clears any currently emitted particles. | |
| destroy() | |
| Destroys the particle emitter. | |
| -- Part | |
| For examples on how to use, refer to PartService. | |
| Creates a Roblox BasePart with a block texture from ItemType. | |
| Functions | |
| setPosition(position: Vector3) | |
| Sets the position of the part. | |
| getPosition(): Vector3 | |
| Returns the position of the part. | |
| setRotation(rotation: Vector3) | |
| Sets the rotation of the part. | |
| getRotation(): Vector3 | |
| Returns the rotation of the part. | |
| setCFrame(cframe: CFrame) | |
| Sets the CFrame of the part. | |
| getCFrame(): CFrame | |
| Returns the CFrame of the part. | |
| setSize(area: Vector3) | |
| Sets the size of the part. | |
| getSize(): Vector3 | |
| Returns the size of the part. | |
| setCollidable(collidable: boolean) | |
| Sets whether the part should collide with other models, blocks, and players. Defaults to true on creation. | |
| setAnchored(anchored: boolean) | |
| Sets whether the part should have physics applied to it. Defaults to true on creation. | |
| setTransparency(transparency: number) | |
| Sets the transparency of the part. Transparency ranges from 0 (opaque) to 1 (invisible). | |
| getTransparency(): number | |
| Returns the transparency of the part. Transparency ranges from 0 (opaque) to 1 (invisible). | |
| destroy() | |
| Destroys the part. | |
| -- Player | |
| Parameters | |
| name: string | |
| The player's Roblox username | |
| displayName: string | |
| The player's Roblox display name | |
| userId: number | |
| The player's Roblox user ID | |
| Functions | |
| getEntity(): Entity | nil | |
| Returns the entity this player is controlling if one is active. | |
| setScale(scale: number) | |
| Resize player by provided multiplier. For example a scale of 2 would make the player twice as big (default player scale is 1). | |
| registerSpeedMultiplier(id: string, multiplier: number) | |
| Registers a speed multiplier for the player. A multiplier of 1 is equal to normal speed, less than 1 is slower than normal speed, and greater than 1 is faster than normal speed. A multiplier value of 2 would be equivalent to double the normal speed of the player. | |
| The id parameter can be any string you wish to use to reference the multiplier. | |
| registerAdditionalAirJumps(id: string, count: number) | |
| Registers additional air jumps for the player. The default air jump count is 0. Air jumps are jumps performed while already in the air. | |
| The id parameter can be any string you wish to use to reference the registered air jump change. | |
| registerJumpHeightMultiplier(id: string, multiplier: number) | |
| Registers a jump height multiplier for the player. A multiplier of 1 is equal to normal height (2 block high jump), less than 1 is shorter than normal height, and greater than 1 is higher than normal height. A multiplier value of 2 would be equivalent to double the normal jump height of the player. | |
| The id parameter can be any string you wish to use to reference the multiplier. | |
| removeSpeedMultiplier(id: string) | |
| Removes the speed multiplier with the given id from the player. | |
| removeAdditionalAirJumps(id: string) | |
| Removes the additional air jumps with the given id from the player. | |
| removeJumpHeightMultiplier(id: string) | |
| Removes the jump height multiplier with the given id from the player. | |
| -- Example usage: | |
| -- Set all player speeds to 2 times normal speed for 30 seconds | |
| -- Set all players to have 1 air jump | |
| for i, player in ipairs(PlayerService.getPlayers()) do | |
| player:registerSpeedMultiplier("speed-boost", 2) | |
| player:registerAdditionalAirJumps("bounce", 1) | |
| task.wait(30) | |
| player:removeSpeedMultiplier("speed-boost") | |
| end | |
| -- Prompt | |
| Description: An in-world ProximityPrompt | |
| For examples on how to use, refer to PromptService. | |
| Creates a Roblox ProximityPrompt. | |
| Functions | |
| onActivated(function: (player: Player) => nil) | |
| Registers a function to run when the prompt is activated. | |
| setObjectText(objectText: string) | |
| Sets the object text. Example: Door | |
| setActionText(actionText: string) | |
| Sets the action text. Example: Open | |
| setActivationDistance(activationDistance: number) | |
| Sets the activation distance in studs. Only players within this distance can use the prompt. | |
| setHoldDuration(holdDurationSec: number) | |
| Sets the duration (in seconds) of hold time needed to activate the prompt. | |
| setKeyCode(keyCode: KeyCode) | |
| Specifies the key code used to activate the prompt. Written as KeyCode.X. | |
| setPosition(position: Vector3) | |
| Sets the position of the prompt. | |
| getPosition(): Vector3 | |
| Returns the position of the prompt. | |
| destroy() | |
| Destroys the prompt. | |
| -- ProgressBar | |
| Description: A progress bar shown on a player's HUD | |
| For examples on how to use, refer to UIService. | |
| Functions | |
| setColor(color: Color3) | |
| Sets the fill color of the progress bar. | |
| setMaxProgress(max: number) | |
| Sets the max progress for the progress bar. | |
| setText(text: string) | |
| Sets a text label on the progress bar. | |
| get(): number | |
| Returns the current progress of the progress bar. For example, a progress bar that has 1 unit of progress with a maximum of 5 units would return 1. | |
| add(amount: number) | |
| Adds the given amount to the current progress. | |
| sub(amount: number) | |
| Subtracts the given amount from the current progress. | |
| set(amount: number) | |
| Sets the progress to the given amount. | |
| addPlayer(player: Player) | |
| Adds a player to the list of players who can view this progress bar. | |
| removePlayer(player: Player) | |
| Removes a player from the list of players who can view this progress bar. | |
| destroy() | |
| Removes the progress bar. | |
| -- TextLabel | |
| Description: An in-world text label | |
| For examples on how to use, refer to UIService. | |
| Functions | |
| setText(text: string) | |
| Sets the font of the text. | |
| setFont(font: Font) | |
| Sets the font of the text from the Roblox Enum for Fonts. Written as Font.Arial. | |
| setPosition(position: Vector3) | |
| Sets the position of the label. | |
| getPosition(): Vector3 | |
| Returns the position of the label. | |
| setTextColor(color: Color3) | |
| Sets the color of the text on the label. | |
| setBackgroundColor(color: Color3) | |
| Sets the color of the background of the label. | |
| setTextTransparency(transparency: number) | |
| Sets the transparency of the text on the label. Transparency ranges from 0 (opaque) to 1 (invisible). | |
| setBackgroundTransparency(transparency: number) | |
| Sets the transparency of the background of the label. Transparency ranges from 0 (opaque) to 1 (invisible). | |
| setSize(size: UDim2) | |
| Sets the size of the label. | |
| setSize(): UDim2 | |
| Returns the size of the label. | |
| setMaxDistance(distance: number) | |
| Sets the max distance at which the label can still be seen. | |
| destroy() | |
| Removes the label. | |
| -- Team | |
| Parameters | |
| name: string | |
| Display name of the team, such as Red | |
| id: string | |
| Identifier of the team, such as 3 | |
| Functions | |
| getInGamePlayers(): Player[] | |
| Returns team members that are actively in game (NOT including spectators). | |