Hit Counter UI Effect

How would one go about to try and script a hit counter effect similar to this

image

The numbers are fine, I just want to know how to script the bar (you see the red bar and the black bar behind it). So when someone hits a player, if they don’t continue hitting the red bar will decrease and once it hits 0 it removes the bar. Wondering if there’s any open source for this if possible, or any guidance on how i can approach this.

1 Like

You haven’t linked an Image. It literally just says “image”, nothing else. Just Click Edit on your topic and drag and drop the image into there.

Ok I have editted it, my apologies.

Use of tweens or Lerp function. Use tick() to know when combo ends

1 Like

There isn’t any Open Source but it would be pretty simple as long as you already have the combat system itself.

I made something simple, here it is:
I made simple gui with counter in it that shows current combo number, and then made 2 frames, Bottom and Top, where Top frame had Size = Udim2.new(1,0,1,0) and AnchorPoint = Vector2.new(0,0.5), then I used this script

Local script inside player

local tweenService = game:GetService("TweenService")
local combo = script.Combo

local waitTime = 5 --Time that will take to end a combo after no hit

local player = game.Players.LocalPlayer
local gui = player.PlayerGui:WaitForChild("ComboShower")
local tweenInfo = TweenInfo.new(waitTime, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0)
local tween = tweenService:Create(gui.Bottom.Top, tweenInfo, {Size = UDim2.new(0,0,1,0)})

combo.Changed:Connect(function()
	if combo.Value ~= 0 then
		gui.Enabled = true
		local currentCombo = combo.Value
		gui.Counter.Text = combo.Value
		
		tween:Cancel()
		gui.Bottom.Top.Size = UDim2.new(1,0,1,0)
		tween:Play()
		
		wait(waitTime)
		if combo.Value == currentCombo then
			combo.Value = 0
		end
	else
		gui.Enabled = false
	end
end)

And this is how it looked like in Explorer
Snímka obrazovky 2022-07-22 141401

All you now need is some combat script that will increase this combo value.
If you have any questions let me know (also make the gui’s Enabled property set to false so you do not see it when you join).

4 Likes

emh how i find the script? like for the local script
bc i try to find it by using Player.PlayerScripts:FindFirstChild("ComboUpdater") and it cant find it