I've already got the code, how do I make multiples as a number?
workspace.Rounds:GetPropertyChangedSignal("Value"):Connect(function()
if workspace.Rounds.Value == 10 20 30 40 50 then
end
end)
I've already got the code, how do I make multiples as a number?
workspace.Rounds:GetPropertyChangedSignal("Value"):Connect(function()
if workspace.Rounds.Value == 10 20 30 40 50 then
end
end)
You can use the % operator in lua which gets the remainder after divison. So in your usecase, any number that is a multiple of 10 will pass.
workspace.Rounds:GetPropertyChangedSignal("Value"):Connect(function()
if workspace.Rounds.Value % 10 == 0 then
-- Rest of code.
end
end)
OK! I will test it, stay safe from covid
Thank you :) Stay safe as well, please accept the answer if it ends up working out for you! :D
It works, Thanks.
also how do i accept the answer? i dont see a button
It is down at the bottom under this text box. http://prntscr.com/s4ahbf
all i just see is report
I'm not too sure- it might be because your account is new. Maybe wait a little and try later? Good luck :)
In order to see if a number is a multiple of ten, you'd want to divide that number by ten to see if it comes out as a whole number. Change your script to this:
workspace.Rounds:GetPropertyChangedSignal("Value"):Connect(function()
num = workspace.Rounds.Value/10
if num == math.floor(num)
end
end)
math.floor rounds the number down. So if a number is the same as itself floored, then it is a whole number because it never had to be rounded. I hope this helps!
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Are you asking how to see if the number (workspace.Rounds.Value) is a number that is a multiple of 10?
its when the value is a multiple of 10