Hello, I’m making a simulator game focused on paper airplanes, and I want to add a power meter, I have the paper airplane thing figured out with velocity, but I want to add a power meter and depending on how good you get it to the faster the plane flies (i hope i explained that well)
I believe that something along these lines could work:
Move the black arrow thingy left and right using a repeating tween.
When the user activates it, stop the tween, and apply some basic maths to it.
The below code doesn’t include the tweening things, but it includes the rest of the logic.
local Bar = Frame.Bar -- The thing that has the fade from red to yellow
local Marker = Frame.Marker -- The black triangle thingy
ACTIVATE.Activated:Connect(function()
local AbsSizeX = Bar.AbsoluteSize.X
local MinXPos = Bar.AbsolutePosition.X
local MaxXPos = MinXPos + AbsSizeX
local MarkerX = Marker.AbsolutePosition.X + Market.AbsoluteSize.X/2
-- Get how far across it is as a value between 0 and 1
local PercentAcross = 1 - (MarkerX - MinXPos) / AbsSizeX
-- Because the highest accuracy is at the middle, the percent is adjusted to
-- have the middle be the highest value
local Accuracy = 1 - 2 * math.abs(PercentAcross - 0.5) -- abs to make it positive
-- Accuracy is a number between 0 and 1, where 1 is directly on the halfway point, and 0 is as far away from it as possible
end)
Note that this code is not tested, so it may not function as intended. If it errors, let me know and I’ll fix it up