#Adding a cooldown
21 messages · Page 1 of 1 (latest)
** You are now Level 5! **
You can see here it checks every frame you're touching the part
Which would just lead to rappid fire encounters
you'd put it after the if statement about what the encounter is
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
This didn't do anything but I did get the same effect as waiting by making the encounter chance out of 100 and anything above 97 encounters
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)
this is how i meant @halcyon topaz
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
cuz, even if you have a wait, you're still touching the part a ton of times as you walk, so therefore roblox is contiously running that code @halcyon topaz
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
tyty i managed to get it to work right
alr np, sorry for the confusion initially