Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

When value has a multiple of 10 script?

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)

2 comments

0

Are you asking how to see if the number (workspace.Rounds.Value) is a number that is a multiple of 10?

0

its when the value is a multiple of 10

2 answers

✓ Accepted answer

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)

8 comments

0

OK! I will test it, stay safe from covid

0

Thank you :) Stay safe as well, please accept the answer if it ends up working out for you! :D

0

It works, Thanks.

0

also how do i accept the answer? i dont see a button

0

It is down at the bottom under this text box. http://prntscr.com/s4ahbf

0

all i just see is report

0

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.