Skip to content

players.setFreecamSpeed

Changes the speeds of a freecam started with players.freecam, in metres per second. Without fastSpeed, the Shift speed is four times speed.

players.setFreecamSpeed(viewer: PlayerTarget, speed: number, fastSpeed?: number): Promise<ActionResult>
Name Type Description
viewer PlayerTarget The player who flies.
speed number Normal flying speed, 0.5-500 m/s.
fastSpeed number Optional. Speed while Shift is held, 0.5-500 m/s. Default four times speed (at most 500).

A promise of an ActionResult: applied once the new speeds are in use, rejected with a code (not-in-freecam, invalid-freecam-speed, player-not-found), or timeout without an answer.

gamemodes/my-mode.ts
import { commands, players } from "nativemp";
commands.register("flyspeed", async (player, args) => {
await players.setFreecamSpeed(player, Number(args) || 12);
});