Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how would i make a stud type of currency?

Asked by
MHaven1 159
5 years ago

i dont have an example sorry. im trying to make a currency type where you get certain amount of money every 1 mile you travel by car or walking but i dont understand so to start i would really appreciate it if someone could help me out with this.someone said i could use VVVVV but i dont know how to use that so it counts the amount of studs you traveled and give you a certain amount of money when you reach 1 mile. you do not have to make the script for me you can just maybe link me to stuff on wiki that might help me with this. TY

local dis = (oldPos-newPos).magnitude
0
I would look at this. https://wiki.roblox.com/index.php?title=API:Class/IntValue  experiment with it, and you can create a system similar to the one you're talking about. legomaster38 39 — 5y
0
it says There is currently no text in this page MHaven1 159 — 5y
0
Sorry all fixed ignore the "experiment" put the rest of the URL in. legomaster38 39 — 5y

1 answer

Log in to vote
1
Answered by
yyyyyy09 246 Moderation Voter
5 years ago

.magnitude uses the good old Pythagorean Theorem to figure out the distance between a two points, your best bet is to use:

local dis = (oldPos-newPos).magnitude

Now what you can do is set the initial distance aka "oldPos" to the current location of the car, wait 0.5 and set newPos to the current location after 0.5 seconds. This gives the distance between two points after 0.5 seconds. You should run this in a loop, and have a seperate variable that holds the overall distance the vehicle has traveled. I suggest sending the distance to the player through a remote event, so a localscript can handle the distance, and put it in an integer, or if you want to be extra cautious, make the client ask for intvalue instead, so no hackers can change it.

Hope this helps.

0
thats great thank you. it helped i didnt know what to do with oldpos and newpos lol i get it now ty. MHaven1 159 — 5y
0
No problem yyyyyy09 246 — 5y
Ad

Answer this question