I am trying to create a combo counter GUI. The issue I’m having is that sometimes the GUI will reset the combo count to 0 before it should. I have tried setting values to bools, different methods, etc.
local HitAmount = script.Parent:FindFirstChild("Hits")
local function Time(ComboTime,Counter)
wait(ComboTime)
if Counter ~= nil then
print(Counter)
HitAmount.Value = 0
Counter:Destroy()
end
end
HitAmount.Changed:Connect(function()
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name == "CounterFrame" then
v:Destroy()
end
end
coroutine.wrap(function()
if HitAmount.Value >= 0 then
local counter = script.Parent:FindFirstChild("FrameSample"):Clone()
counter:FindFirstChild("Count").Text = tostring(HitAmount.Value)
counter.Name = "CounterFrame"
counter.Parent = script.Parent
local RUD = math.random(-10,10)/500
local RLR = math.random(-10,10)/500
counter.Position = UDim2.new((0.05+RLR),0,(0.4+RUD),0)
counter.Visible = true
Time(3,counter)
end
end)()
end)```