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

How to set a 0. before a number? [Answered]

I have a NumberValue, it's like 10. How to make another value, wich is making the 10 to 0.10 with can be used on Properties values. i tried this:

Speed = 10
Speed2 = "0." ..Speed
Sound.Volume = Speed2

But it isn't working.

2 comments

0

No, it dosn't work

0

You can press the Accept Answer button. Do yourself a favour.

2 answers

✓ Accepted answer

Divide

Surely you know how to divide. To make a number scaling from 0 to 100 into a decimal, which I assume is what you're doing given the context, just divide it by 100.

Speed = 10
Speed2 = Speed/100
Sound.Volume = Speed2

You're attempting to concatenate Speed with a string, which will then convert the value of Speed to a string inside of the variable, making Speed2 equal to the PHRASE "0.10", but not the value 0.10. The following code should fix your problem.

Speed = "10"
Speed2 = "0." .. Speed
Speed3 = tonumber(Speed2)

Sound.Volume = Speed3

1 comment

0

0.1 is not an integer

This discussion is preserved as it was. New answers, comments, and votes are closed.