#Adding a cooldown

21 messages · Page 1 of 1 (latest)

halcyon topaz
#

Does anyone know where I'd put the wait statement to add a cooldown to get the chance to encounter. I've tried putting it everywhere but it just delays the action and then checks every frame

uneven havenBOT
#

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

halcyon topaz
#

You can see here it checks every frame you're touching the part

#

Which would just lead to rappid fire encounters

knotty drift
#

like beneath the end that comes after the "ENCOUNTER MONSTER COMMON"

#

also be sure to use task.wait() as it is more accurate that just wait() from what I've heard

halcyon topaz
knotty drift
#

local randomNumber = math.random(1,10)
if randomNumber >= 7 and not cooldown then
local encounterRarity = math.random(1,10)
if encounterRarity == 10 then
print("epic")
elseif encounterRarity > 7 then
print("rare")
else
print("common")
end
end
task.wait(10)

knotty drift
#

sorry I think I got a bit confused explaining it

#

WAIT

#

actually

#

Ik why now

#

Sorry, I got it wrong so

#

my solution would be to add in a cooldown variable

knotty drift
#

so you'll need a cooldown variable that ensures once you touch it once, then it'll wait a bit before running the code again

halcyon topaz
knotty drift