Tweening Gui Meters

So I’m making a shooting meter for my basketball game and im using tweening to make it and when the meter gets to the top it pauses for a second which I don’t want in my game. Also I know Ineed to make a douebounce for it too.

https://gyazo.com/3282c39f06ccfc9412525edcba28addb

local ShotMeter = PlayerGui:WaitForChild("ShotMeter") ; ShotMeter.Adornee = HumanoidRootPart 
local Remotes = ReplicatedStorage:WaitForChild("Remotes")


local HoldingF = false 
local CanHold = true 
local BarDown =false
local BarUp = false 

UserInputService.InputBegan:Connect(function(Input,GameProcessedEvent)
	if GameProcessedEvent then return end 
	
	if Input.KeyCode == Enum.KeyCode.E then
		BarUp = true ; ShotMeter.Enabled = true 
		
	end
	
		
		
		
		
	
	
	
	
	
end)

UserInputService.InputEnded:Connect(function(Input,GameProcessedEvent) 
	if GameProcessedEvent then return end 
	
	if Input.KeyCode == Enum.KeyCode.E then
		BarDown = false ; BarUp = false
		wait(1) ; ShotMeter.Enabled = false ; ShotMeter.Bar.Size = UDim2.new(1,0,0,0)
	end
	
	
	
	
end)



RunService.Heartbeat:Connect(function() 
	
	local Size = ShotMeter.Bar.Size
	if BarDown then print("BARDOWN")
		ShotMeter.Bar:TweenSize(UDim2.new(1,0,Size.Y.Scale + Speeds.RegularShot,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.06,true)
		print(ShotMeter.Bar.Size.Y.Scale)
		if ShotMeter.Bar.Size.Y.Scale >= -0.2 then BarDown = false ; ShotMeter.Bar.Size = UDim2.new(1,0,0,0)  return end 
	end 
	if BarUp then print("BARUP")
		ShotMeter.Bar:TweenSize(UDim2.new(1,0, Size.Y.Scale - Speeds.RegularShot,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.06,true)
		print(ShotMeter.Bar.Size.Y.Scale)
		if ShotMeter.Bar.Size.Y.Scale <= -1 then BarUp = false ; ShotMeter.Bar.Size = UDim2.new(1,0,1,0) ; BarDown = true  return end 
	end
	
	
end)

1 Like