Press E on the right time (Help)

Good day Devs!

So I want to do this v (《-Arrow)
I Want to acheive this. image

Source: Flee the facility

As you can see you need to press E on the right time. I know I need UIS but

Take note that:

  • Im finding on how to detect if the Arrow/Gui is on the right place

  • Not trying to make that circle gui, Just a bar.

  • Im pretty new to some advanced terms here so please elaborate/explain.

Ive seen a post and it was a mostly on the GUI and some circle gang shabang. I have no idea on what’s this called. Please do let me know. Thanks!

2 Likes

If you just want to do this with a bar, this is actually quite simple. Add a “target” zone to the bar, which is where the player should click E. When the arrow is stopped, check to see if it’s position is within the range of the target. The range of the target should be the central position +/- half the width of it.

I do get it. The question is, @MayorGnarwhal how to detect if the arrow is on the target zone.

target in range.rbxl (22.6 KB)

Here I created a simple example of how to do this. The code explained a bit in the comments, but basically just check to see if the arrow’s position is somewhere inside of the part, which requires doing math with the target’s position and size.

This is the specific line in question. The Target’s anchor point is (0,0) so you can check the position (left side) and the position + size (right side) against the arrow’s position.

if Target.Position.X.Scale < Arrow.Position.X.Scale and Arrow.Position.X.Scale < Target.Position.X.Scale + Target.Size.X.Scale then
1 Like

@kaspar1230 Ive seen your post. Problem is, the circle part confuses me the most. So i tried asking again. Also as i said, Im not trying to make a Circle, Just a bar.

a bar is sooooo much easier than a circle. and this is very simple

1 Like

Alright, Iv’e Just woke up and have checked this on my computer. Seems like i just need to time it. I’m Probably thinking for i or either make a loop which counts the number, then the if would be given something like this:

while Count == 1 or 2 or 3 or 4 or 5 do --Idk on how to do this better (Maybe until loop)
 --If blah blah blah then
end

I think the easiest way to do this is to just set up a time window where you have to send input, and always make it a fail when input is sent outside of the time frame.

Doing UI math to check whether a line is within a bar is pretty ridiculous if you ask me, because after all, the most efficient coding is the simplest - and in this case, it’s putting in a time frame and syncing it with a spinning circle.