Skip to main content

Concept of Metadata

Metadata of a skill / statusEffect is basically a state that is replicated from server to client. There are many use cases to this: For example, you can use this to tell the client the current skill target / or some other information from the server.

warning

Metadata changes are deferred, so if you change it multiple times in a single heartbeat tick the MetadataChanged event will only be fired once with the latest changes.

attack.ts
import { Skill, SkillDecorator } from "@rbxts/wcs";

@SkillDecorator
export class Attack extends Skill<void, [], number> {
public OnStartServer() {
task.wait(2)
this.SetMetadata(5);
}

// this method is getting invoked when the class gets instantiated
public OnConstructClient() {
this.MetadataChanged.Connect((NewMeta) => print(NewMeta));
}
}
note

The usage with status effects is the same.