Skip to main content

Holdable Abilities

Sometimes, you want to create an ability that you can use for an unknown amount of time, depending on user input.

WCS introduces a whole new ability type for this case: HoldableSkill, which you can specify the max hold time of and run the callbacks whenever it ends like on a regular ability.

Let's make a file called block and register a holdable ability:

block.ts
import { HoldableSkill, SkillDecorator } from "@rbxts/wcs";

@SkillDecorator
export class Block extends HoldableSkill {}

Then set the max hold duration to undefined, so we could hold the block indefinitely.

block.ts
import { HoldableSkill, SkillDecorator } from "@rbxts/wcs";

@SkillDecorator
export class Block extends HoldableSkill {
public OnConstructServer() {
this.SetMaxHoldTime(undefined);
}
}
note

You can determine if the ability is holdable or not by calling GetSkillType().