#Heartbeats in heartbeat minigame triggering when not supposed to

1 messages · Page 1 of 1 (latest)

covert raft
#

When more than one heartbeat show up on one side, when i hit only one it prints "hit" and "miss"x the amount of other heartbeats there are. Or, when i miss one, it prints "missed" twice. How do i make it so then it only targets one heartbeat at a time?

#

if you have questions feel free to ask

nimble horizonBOT
#

studio** You are now Level 5! **studio

leaden pebble
#

just keep track of the next heart

#

you could of all the hearts in a ordered list

#

and just remove it when you click

#

and only check the first one in the list if you hit it at the right time

glacial night
#

make a table

activehearts = {}

use indexing

currentIndex = 1

minigame part

functionheartbeat()
(insert whatever condition is required for the minigame to take place)
activeHearts[currentIndex] = {
canHit = false }

task.delay(0.5, function()
    if not activehearts[currentIndex] then return end
    activehearts[currentIndex].canHit = true
end)

task.delay(0.8, function()
    if not activeHearts[currentIndex] then return end
    activeHearts[currentIndex].canHit = false

if Enum.UserInputType.MouseButton1 and canHit.Value == true then
table.remove(activehearts, currentIndex)
currentIndex += 1

note dont copy and paste the code above its jst there to show the structure

#

the actual logic is

#

list tracks active hearts we only check the current index for inputs, if an input is recieved remove the current index and move to the next index

#

actually wait i think removing the current and going to the next bugs it

#

maybe just remove the current if it doesnt work

#

idk im not super experienced

covert raft
#

nevermind, i added a queue system with for i ipairs loop then broke out when i found the first heartbeat'

leaden pebble
#

why would you loop through it every time

glacial night
leaden pebble
#

I said it first