|
| 12 Oct 2013 09:19 PM |
OK, complete simple I thinks. Theres a 4 number values in workspace, theres an intvalue in workspace. Number values called number1, number2, number3, and number4 , intvalue called int. SIMMPLE!
Heres the hard or simple part, whatever the part I cant do or understand. How to split the intvalue into the four number values. So basically the int value is 1337, when the script is activated the number values will become the digits like 1 for number1, 3 for number2, 3 for number3, and 7 for number7. Please help me figure out how to make this possible, I think it involves strings but I don't get that part either. This is only part of a big project and I would hate for it to stop here. |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2013 09:38 PM |
double post
each_num = {} str = tostring(1248731598612340987132486145987625)--random numbers for i = 1,#str do each_num[i] = tonumber(string.sub(str,i,i)) end
game.Workspace.Number1.Value = each_num[1] game.Workspace.Number2.Value = each_num[2] game.Workspace.Number3.Value = each_num[3] game.Workspace.Number4.Value = each_num[4] |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2013 11:24 PM |
| ya that's good but how does it connect with the intvalue? |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2013 02:24 PM |
| bump and seriously hows that connect with the intvalue |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2013 02:46 PM |
Intvalue is a number, and I don't think you can split numbers up.
If you'd use a string instead, you could use this:
string.sub(intvalue, 1, 1) string.sub(intvalue, 2,2) etc.
Although in that case, I am not sure if you'd be able to convert it back into numbers.
-Believe and you will achieve- |
|
|
| Report Abuse |
|
|
08C
|
  |
| Joined: 26 Jan 2013 |
| Total Posts: 847 |
|
| |
|
|
| 13 Oct 2013 05:11 PM |
| well im trying to make an arcade game and every player has a score leaderboard. I have made it that the person with the highest score, their score goes to a number value in workspace. From their that number value(called ServerHighScore) is split into different digits to make a sign. There are four bricks with a number value in them, and they also have a script and a decal. The script decides the decal based on the value. They are placed near each other so it looks like the score is on there. This is why I need the script. |
|
|
| Report Abuse |
|
|