Decided to rewrite this hopefully to make it more simple and understandable.
How can you make a second variable record the first variables values.
for example:
*Variable 1 starts setting to random numbers (ex/ 1,5,3,7,3)
variable 2 waits 1 second and then starts from the beginning of Variable 1 (ex/ 1,5,3,7,3)*
I don't want to set Variable 2 to the newest value of number of Variable 1
Sorry for confusion.
If you want var2 to be whatever var1 was 1 second ago, use this:
function SetVar1(value) var1 = value delay(1, function() var2 = value end) end SetVar1(5)
With this method, you never use "var1 = 5", you use "SetVar1(5)".
It doesn't need to be delayed a different way, wait() is fine, a for loop automatically adds 1 so you don't need the line var1 = var1+1
, and you should probably define var2 before you start the loop.
try this:
local var2 for var1=1,5 do print ("var1 " ..var1.."") wait(3) var2 = var1 print ("var2 " ..var2.."") end
If you're trying to print "1,2,3,4,5", then all you need is a for loop. It looks to me you're just not sure how to use the loop.
for var1 = 1,5 do print(var1) wait(1) end