Help with speed boost platform

Im new to this and am trying to make some sort of 3d platformer game, and cant figure out how to put in a speed boost, if anyone could help me out i would very thankful :smiley:

Hey @LUCAS_MITCHELL,

Welcome to the forum! Are you thinking of a simple speed multiplier? If so, it may be fairly simple. If you’re moving your character with something like entity.translate(), you should be able to do the following:

if (this.hasSpeedBoost) {
    this.entity.translate(this.speed * this._movement * this.speedMultiplier);
}
else {
    this.entity.translate(this.speed * this._movement);
}

The key, really, is simply to have a boolean variable that allows the script to check whether there is a speed boost active. If you do have a speed boost active, multiply your normal this.speed variable by a this.speedMultiplier variable.
You can then simply enable it by calling it from another script:

player.scripts.playerController.hasSpeedBoost = true;

Let me know if you get stuck!

I will try this, thanks :smiley:

@poliveira so the top script is separate from player.scripts.playerController.hasSpeedBoost = true;? because i put in the top script and when i parsed it in the game editor it said "cannot read properties of undefined (reading ‘translate’)

Hey @LUCAS_MITCHELL,

Can you post your script or project here? It’d be easier to help you that way!