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: calculating speed/time

Previous Thread :: Next Thread 
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 05:34 PM
what would would i insert into a "wait" if i wanted an inital value to reach a final value what the intial and final value is

like it would take 7 seconds for the initial value to reach the maximum value regardless of what the maximum value is

example 1: inital value = 0
max value = 50
0 goes to 50 in a 7 second span
example 2: intial value = 0
max value = 200
0 goes to 200 in a 7 second span
example 3: initial value = 10
max value = 70
10 goes to 70 in a 6 second span(since the inital value is already at 10)

p.s. this was already asked but it was too vague
Report Abuse
EradicateTheNoobs is not online. EradicateTheNoobs
Joined: 03 Feb 2012
Total Posts: 1314
09 Oct 2015 05:38 PM
repeat
wait(0.5)
script.IntValue.Value = script.IntValue.Value + 1
until script.IntValue.Value == 10


Put an intvalue in a script and make the value 0
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 05:42 PM
but that doesn't have a max val.. look:


for i = 1, maxValue-initalValue do
initalValue.Value = initalValue.Value+1
wait(7/i) -- i tried this but doesnt work
end
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
09 Oct 2015 05:44 PM
http://wiki.roblox.com/index.php?title=Absolute_beginner%27s_guide_to_scripting

-=Robo=-
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 05:48 PM
b1
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 05:55 PM
b2
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 06:07 PM
b3
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 06:18 PM
b4
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 06:27 PM
B5
Report Abuse
EradicateTheNoobs is not online. EradicateTheNoobs
Joined: 03 Feb 2012
Total Posts: 1314
09 Oct 2015 06:32 PM
repeat
wait(0.5)
script.IntValue.Value = script.IntValue.Value + 1
until script.IntValue.Value == script.MaxValue.Value


The noobs shall be eradicated.
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 06:38 PM
thats not what im asking, what needs to be modified is what's within the wait()
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 06:50 PM
bump
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
09 Oct 2015 06:56 PM
http://wiki.roblox.com/index.php?title=Absolute_beginner%27s_guide_to_scripting [2]

-=Robo=-
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
09 Oct 2015 07:00 PM
for i = 1,70,1 do
maxvalue = i
wait()
end

i'm not your math teacher so i won't bother calculating the wait for it.
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
09 Oct 2015 07:02 PM
Stop bumping and go back to math class.

If you want 7 seconds to elapse with an event firing multiple times in said time, you'd obviously divide the amount of time by the amount of iterations to get the delta time to wait between iterations.
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 07:11 PM
rude
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
09 Oct 2015 07:13 PM
What's rude is bumping 80 times when you're already on the front page for such a trivial question.
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 07:16 PM
its trivial for u

i keep bumping until i get an answer i understand

bump
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
09 Oct 2015 07:25 PM
^idiots don't understand
try google or perhaps
http://wiki.roblox.com/index.php?title=Absolute_beginner%27s_guide_to_scripting

-=Robo=-
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
09 Oct 2015 07:28 PM
If you want something to happen 10 times in seven seconds
7/10 = .7
The wait time would be .7 seconds

If you want something to change from 0 - 50 over 10 iterations
50/10 = 5
Add 5 to each iteration

Some people shouldn't be allowed on the internet without taking an IQ test. You're one of those people.
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 07:33 PM
not what im asking.. i said it has take 7 seconds to get from any given intial value to any maximum value i posted the line earlier
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
09 Oct 2015 07:37 PM
That's exactly what I just explained. .-.
num = 0
for i = 1,10 do
wait(.7) -- .7*10 = 7 seconds
num = num+5 -- 5*10 = 50
end

'example 1: inital value = 0
max value = 50
0 goes to 50 in a 7 second span'

>7 seconds elapse and num changes from 0 to 50
Report Abuse
qoazi is not online. qoazi
Joined: 16 Oct 2008
Total Posts: 2
09 Oct 2015 07:57 PM
From any value, To any value in 7 seconds. Always 7 seconds right?



for i = initalValue, maxValue do
initalValue.Value = initalValue.Value+1
wait(7/(maxValue - initialValue))
end

This should Count From the initialValue, up to the Maxvalue, Waiting a 7th of the amount of iterations each time, Since it's a 7th of the amount of iterations, And it Always iterates all the way, That will Always add up to a total 7 second wait
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Oct 2015 08:23 PM
well not from ANY initial value to ANY max value.. i know 0 to 50 will take 7 seconds but let's say it was 40 to 50, it doesn't take 7 seconds, it takes a smaller amount of time since 40(the initial value) is already at 40.. if that makes sense
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
09 Oct 2015 08:30 PM
Take the delta, start from minvalue
iterations = ??? - set between 1- ~210
delta = (max-min)/iterations
num = min
for i = 1,iterations do
wait(7/iterations)
num = num+delta
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