Run a function only when a NumberValue reaches a specific value?

It’s being tweened down, so it isn’t going down by whole numbers.

1 Like

Then use two different values rather than one??

1 Like

that would work
or maybe math.floor()
or math.celi()

1 Like

This forum so stupid :man_facepalming::man_facepalming::man_facepalming:

(joke)

2 Likes

lol
YOUR the one asking for a countdown script that any person with the smallest bit of experience could do :sob: (maybe not efficiently, but they could)

1 Like

I’m not asking for a countdown script. I already have that implemented. I’m asking for an alternative method of running a function. What the actual hell have you been reading? I’m not trying to start an argument here, but half of what you’ve posted hasn’t made any sense.

2 Likes

i gave you diff solutions man
your welcome btw for helping!

1 Like

Yes, you gave me solutions that I previously stated cause lag for me, so great job doing nothing, I guess.

2 Likes

yw! hope you have a good day/night and cya man

1 Like

ok, i will! thanks idk what my attention span ahs to do with anything, i also didn’t know you could get that checked out, or if thats even a problem man!

1 Like

(what context)
cool man! didn’t know that!
(what are you implying lmao)

2 Likes

can you not just

value.Changed:Connect(function()
if value == 0 then
 -- code here 
end
end)
2 Likes

Unfortunately because I am tweening the value, this function would run 100 times per second, which will definitely lag my game.

3 Likes
math.ceil() --rounds up
--or
math.floor() --rounds down
--so maybe
math.floor(value).Changed:Connect() -- or just replace floor with ceil to round up

could fix that by rounding it and checking when the second changes, not the millisecond

ywwwww

gave you the answer lolol

but ignored due to you worrying about the argument

2 Likes

Actually math.round() would be better suited for this situation, so technically you still didn’t give me a correct answer. I did.

3 Likes

Not necessarily. 100 operations for the server is relatively nothing, same with repeat.
But, if you are afraid of lag, you can use RunService.

local RunService = game:GetService("RunService")
RunService.Stepped:Connect(function()
 if value < 0 then
  do something about it
 end
end)
4 Likes

Even better than what I was about to do! Thanks!

3 Likes

nice ego dude, they all do the same thing
except for how they round, they all round
yw for the idea, and maybe don’t be such a prick to someone whos helping you write a script
and using adhd as an insult says alot about you, my man, have a good dayyyy

2 Likes

dayum the hell happened here :skull:

4 Likes

irdk, i tried to help, was given no context or anything, and he got upset for me trying to help
then tried to insult me (by implying i have adhd and i should go see a doctor)
lol

2 Likes