Don't know what it is called, or how to script it

Whats it called when like a bar is moving back and forth and you have to press space or something when the bar is over green for it to do something. Like in undertale’s damage system, when you have to click space in a certain area to deal more damage. And also how would I script that? I’ve been trying to think how to do that and I have no clue.

So there are many ways to make this through GUIs to actual physical objects. However, I’m not so experienced with GUIs so I’ll give some help through physical objects. First create a long vertical part. Then you would add an object that would appear moving toward and then past the long vertical part until it hits some end part. Finally add scripts to detect when these parts collide. I tried to at least give you an idea of how to do this, but these articles can be helpful for making physical objects for your combat ideas

BodyVelocity to cause moving parts

UserInputService for detecting input

Hope this helps!

If you’re talking about GUI, then what you have to do is measure the distance between the current bar’s location vs the target location (maybe the middle). Subtract the AbsolutePositions and use .magnitude to get the distance in number form. The closer the value is to 0, the more accurate the player is.

There are extra things you also need to do:

  • Make the bar move back and forth
  • Make the bar stop when a button is pressed
  • Finally, react to the result
1 Like