Finding the Damage Variable

Finding the Damage Variable

Finding the Damage Variable

Now to find the numbers controlling the damage output and really make things painful!

  • Look at the top of your script and find local DAMAGE = 5.

That’s a number type variable. Variables are placeholders for information. Number type variables are good for working with, well, numbers, or in this case, subtracting health points.

Here, for local DAMAGE = 5, the variable is named DAMAGE and the number is how many health points the player will lose. It’s currently only set to the number 5.

To create a more painful trap part:

  1. Change local DAMAGE = 5 to local DAMAGE = 20.
  2. Use Play Here to check if the code works and the cube does more damage.
  3. Stop the playtest.
  4. Save your work (FilePublish to Roblox) if it's been a while.
Experiment with the Damage

If you think this still isn't enough damage, try setting local DAMAGE to an even higher number! Just remember that players only have 100 health points.

Previous Doing More Damage Next Copying Code to Other Parts