You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I am trying to make a cos counter that doesn’t reset but goes to 0 when someone stops clicking (the Minecraft one)
What is the issue? Include screenshots / videos if possible!
Every cps counter that there is resets
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
1 Like
Ok but why are there no solutions you’ve tried
Hello!
This is an example of a quick clicking speed test. The code is similar to yours and GUIs are organized this way:
[image]
Clicks label and ClickerInput text button don’t have any properties changed while game is running, as opposed to DisplayClicks, which displays number of clicks in a second, and DebounceGui, which only shows up for a short time as a cooldown notification.
[image]
local clicks = 0
local validClicks = true
local debounce = false
local debounceGui = script.Parent.Pare…
1 Like
wdym? Also the link that you linked me I already tried and it resets after a second
You’ve literally put nothing after the third suggestion
Also can’t you just literally set the Click Counter to 0 after a second passes or something through a infinite loop?
local CurrentClicks = 0
GuiThing.MouseButton1Down:Connect(function()
CurrentClicks += 1
end)
while true do
wait(1)
CurrentClicks = 0
end
Here’s a video showcasing what I mean
(Doesn’t need to be chroma)
This is probably the closest thing I could find?
So I’m assuming your damage indicators are on the client side? If so this should be relatively easy, here’s some pseudocode:
currentgui = nil
num = 0
function showdamage(damage, person)
if not currentgui then
local gui = makegui(damage, person)
currentgui = gui
else
changeguinumber(gui, damage)
end
local localnum = num
delay(1, function()
if localnum == num then
gui:Destroy()
currentgui = nil
end
end)
end
H…
You’d need to get the average clicks counted back every second possibly using tick()
, then slowly decreasing/increasing the value depending on how much CPS there are
could you show me how the script would look
Haven’t tested but something like this should work, just connect OnMouseButton1Down to something and call Average() whenever you want the average.
local BUFFER_SIZE = 30; -- seconds to get running average for
local counters = table.create(BUFFER_SIZE, 0)
local current = 1; -- lua is 1-indexed
local last = time(); -- init() equivallent
-- update() equivallent
-- could use Stepped or Heartbeat here too but whatever
game:GetService("RunService").RenderStepped:Connect(function()
local now = tim…
Ok attempt #2 , if this isn’t what you’re looking for then idk what else to do
1 Like