generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How would one go and make a money script?

Previous Thread :: Next Thread 
Negativize is not online. Negativize
Joined: 02 May 2011
Total Posts: 25068
13 Jul 2016 08:30 PM
One that is like this:

1k, 2.45M, 3.46B, etc

How hard would that be? And what would I have to use to make it?
Report Abuse
Shiro75 is not online. Shiro75
Joined: 18 Jan 2010
Total Posts: 587
13 Jul 2016 08:34 PM
By "1k, 2.45M, 3.46B, etc" do you mean that the script uses letters like k, M, and B to shorten big numbers?
Report Abuse
Negativize is not online. Negativize
Joined: 02 May 2011
Total Posts: 25068
13 Jul 2016 08:34 PM
'By "1k, 2.45M, 3.46B, etc" do you mean that the script uses letters like k, M, and B to shorten big numbers?'

Yes
Report Abuse
Negativize is not online. Negativize
Joined: 02 May 2011
Total Posts: 25068
13 Jul 2016 08:40 PM
b
Report Abuse
Shiro75 is not online. Shiro75
Joined: 18 Jan 2010
Total Posts: 587
13 Jul 2016 08:44 PM
I don't think that would be to difficult.

Everytime the money changes, you could probably just find the length and use conditions that explicitly state the minimum length of each thousand, million, etc. Check the length in the order from the largest category to the least.

something like..

local money = tostring(money.Value)
local length = string.len(money)
if length >= 13 then
print(string.sub(money, 1, 3) .. "B")
-- http://wiki.roblox.com/index.php?title=Function_dump/String_manipulation#string.sub
elseif length >= 10 then
Report Abuse
Shiro75 is not online. Shiro75
Joined: 18 Jan 2010
Total Posts: 587
13 Jul 2016 08:46 PM
I'm sorry, that was just a bit of a quick outline.

print(string.sub(money, 1, 3) .. "B")

That part is problematic though, but you could find a way around that by adding more conditions after its category is determined.
Report Abuse
Negativize is not online. Negativize
Joined: 02 May 2011
Total Posts: 25068
14 Jul 2016 06:47 PM
Bump. I tried your method and it doesn't work past length > 14 due to number limits.

Any other methods would be appreciated.
Report Abuse
Negativize is not online. Negativize
Joined: 02 May 2011
Total Posts: 25068
14 Jul 2016 06:53 PM
Beautiful 5 minute bump
Report Abuse
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
14 Jul 2016 06:57 PM
Don't use actual numbers with your money them, store them as 1.2B and so on in the beginning, then when buying things, you can use your code to subtract .1B respectively.


#code print("while false do end")
Report Abuse
Negativize is not online. Negativize
Joined: 02 May 2011
Total Posts: 25068
14 Jul 2016 06:58 PM
'Don't use actual numbers with your money them, store them as 1.2B and so on in the beginning, then when buying things, you can use your code to subtract .1B respectively.'

Explain, please. Would I use tostring() and tonumber()?
Report Abuse
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
14 Jul 2016 07:02 PM
I'm terrible with math, but if your numbers are getting too large for ROBLOX to handle, I'm saying you could try this:

local money = "1K"
local current = "K"

local money = tostring(tonumber(money:sub(1,1)) + 1).."K" --This now equals 2K

if current == "K" then
--Buying in the thousands range
local thousands = tonumber(money:sub(1, (#money - 1)))
if (thousands > 2.1) then
thousands = (thousands - 2.1)
money = tostring(thousands).."K"
end
end

They obviously only have 2K, not 2.1K (enough to buy whatever) but that's just an inefficient example of how to get around the maximum number problem.


#code print("while false do end")
Report Abuse
arshiaslaya is not online. arshiaslaya
Joined: 04 Nov 2012
Total Posts: 2670
14 Jul 2016 07:03 PM
use multiple number values.For example if you have 1000.make it so it changes to 0 and stores it at 1 on another number value called thousands for example.
Report Abuse
Negativize is not online. Negativize
Joined: 02 May 2011
Total Posts: 25068
14 Jul 2016 07:08 PM
'use multiple number values.For example if you have 1000.make it so it changes to 0 and stores it at 1 on another number value called thousands for example.'

Example of this being used? Would I do this:

k = 0

if money > 1000 then
k = k + 1
money = 0
end
Report Abuse
Negativize is not online. Negativize
Joined: 02 May 2011
Total Posts: 25068
14 Jul 2016 07:16 PM
b2
Report Abuse
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
14 Jul 2016 07:18 PM
@OP

I know the example I provided was weak, but if you set it up with some string patterns and make a prebuilt lib with all your functions for it pre-made, it would work well.


#code print("while false do end")
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image