How would I go about making certain objects appear at the same and certain time?
Asked by
7 years ago Edited 7 years ago
What I am trying to do is if two or more objects hold the same 'value' (seconds), they should appear, or in this case, come down at the same `time'. I am almost happy with the result but it is not quite there, yet. Both the module and localscripts are provided below
ModuleScript
005 | [ 1 ] = { 0.063 , 0.4811924769908 } , |
006 | [ 2 ] = { 0.126 , 0.4811924769908 } , |
007 | [ 3 ] = { 0.252 , 0.4811924769908 } , |
008 | [ 4 ] = { 0.063 , 0.6952781112445 } , |
009 | [ 5 ] = { 0.252 , 0.6952781112445 } , |
010 | [ 6 ] = { 0.126 , 0.9093637454982 } , |
011 | [ 7 ] = { 0.252 , 0.9093637454982 } , |
012 | [ 8 ] = { 0.063 , 1.124449779912 } , |
013 | [ 9 ] = { 0.252 , 1.124449779912 } , |
014 | [ 10 ] = { 0.126 , 1.3385354141657 } , |
015 | [ 11 ] = { 0.252 , 1.3385354141657 } , |
016 | [ 12 ] = { 0.126 , 1.7677070828331 } , |
017 | [ 13 ] = { 0.252 , 1.7677070828331 } , |
018 | [ 14 ] = { 0.126 , 1.9817927170868 } , |
019 | [ 15 ] = { 0.252 , 1.9817927170868 } , |
020 | [ 16 ] = { 0.126 , 2.1958783513405 } , |
021 | [ 17 ] = { 0.252 , 2.1958783513405 } , |
022 | [ 18 ] = { 0.063 , 2.4099639855942 } , |
023 | [ 19 ] = { 0.189 , 2.4099639855942 } , |
024 | [ 20 ] = { 0.126 , 2.625050020008 } , |
025 | [ 21 ] = { 0.252 , 2.625050020008 } , |
026 | [ 22 ] = { 0.063 , 2.8391356542617 } , |
027 | [ 23 ] = { 0.252 , 2.8391356542617 } , |
028 | [ 24 ] = { 0.126 , 3.0532212885154 } , |
029 | [ 25 ] = { 0.252 , 3.0532212885154 } , |
030 | [ 26 ] = { 0.126 , 3.4823929571829 } , |
031 | [ 27 ] = { 0.252 , 3.4823929571829 } , |
032 | [ 28 ] = { 0.063 , 3.6964785914366 } , |
033 | [ 29 ] = { 0.252 , 3.6964785914366 } , |
034 | [ 30 ] = { 0.252 , 3.9105642256903 } , |
035 | [ 31 ] = { 0.189 , 3.9105642256903 } , |
036 | [ 32 ] = { 0.189 , 4.125650260104 } , |
037 | [ 33 ] = { 0.252 , 4.125650260104 } , |
038 | [ 34 ] = { 0.063 , 4.3397358943577 } , |
039 | [ 35 ] = { 0.189 , 4.3397358943577 } , |
040 | [ 36 ] = { 0.126 , 4.5538215286114 } , |
041 | [ 37 ] = { 0.252 , 4.5538215286114 } , |
042 | [ 38 ] = { 0.252 , 4.7689075630252 } , |
043 | [ 39 ] = { 0.189 , 4.7689075630252 } , |
044 | [ 40 ] = { 0.063 , 5.1970788315326 } , |
045 | [ 41 ] = { 0.252 , 5.1970788315326 } , |
046 | [ 42 ] = { 0.126 , 5.4111644657863 } , |
047 | [ 43 ] = { 0.252 , 5.4111644657863 } , |
048 | [ 44 ] = { 0.252 , 5.6262505002001 } , |
049 | [ 45 ] = { 0.126 , 5.6262505002001 } , |
050 | [ 46 ] = { 0.252 , 5.8403361344538 } , |
051 | [ 47 ] = { 0.063 , 5.8403361344538 } , |
052 | [ 48 ] = { 0.126 , 6.0544217687075 } , |
053 | [ 49 ] = { 0.252 , 6.0544217687075 } , |
054 | [ 50 ] = { 0.063 , 6.2695078031212 } , |
055 | [ 51 ] = { 0.252 , 6.2695078031212 } , |
056 | [ 52 ] = { 0.126 , 6.4835934373749 } , |
057 | [ 53 ] = { 0.252 , 6.4835934373749 } , |
058 | [ 54 ] = { 0.063 , 6.9117647058824 } , |
059 | [ 55 ] = { 0.252 , 6.9117647058824 } , |
060 | [ 56 ] = { 0.189 , 7.1268507402961 } , |
061 | [ 57 ] = { 0.252 , 7.1268507402961 } , |
062 | [ 58 ] = { 0.126 , 7.3409363745498 } , |
063 | [ 59 ] = { 0.252 , 7.3409363745498 } , |
064 | [ 60 ] = { 0.063 , 7.5550220088035 } , |
065 | [ 61 ] = { 0.063 , 7.5550220088035 } , |
066 | [ 62 ] = { 0.126 , 7.7701080432173 } , |
067 | [ 63 ] = { 0.063 , 7.7701080432173 } , |
068 | [ 64 ] = { 0.189 , 7.984193677471 } , |
069 | [ 65 ] = { 0.252 , 7.984193677471 } , |
070 | [ 66 ] = { 0.063 , 8.1982793117247 } , |
071 | [ 67 ] = { 0.252 , 8.1982793117247 } , |
072 | [ 68 ] = { 0.252 , 8.6274509803922 } , |
073 | [ 69 ] = { 0.063 , 8.6274509803922 } , |
074 | [ 70 ] = { 0.189 , 8.8415366146459 } , |
075 | [ 71 ] = { 0.126 , 8.8415366146459 } , |
076 | [ 72 ] = { 0.252 , 9.0556222488996 } , |
077 | [ 73 ] = { 0.189 , 9.0556222488996 } , |
078 | [ 74 ] = { 0.189 , 9.2707082833133 } , |
079 | [ 75 ] = { 0.252 , 9.2707082833133 } , |
080 | [ 76 ] = { 0.252 , 9.484793917567 } , |
081 | [ 77 ] = { 0.063 , 9.484793917567 } , |
082 | [ 78 ] = { 0.063 , 9.6988795518207 } , |
083 | [ 79 ] = { 0.126 , 9.6988795518207 } , |
084 | [ 80 ] = { 0.063 , 9.9129651860744 } , |
085 | [ 81 ] = { 0.063 , 9.9129651860744 } , |
086 | [ 82 ] = { 0.252 , 10.342136854742 } , |
087 | [ 83 ] = { 0.063 , 10.342136854742 } , |
088 | [ 84 ] = { 0.126 , 10.556222488996 } , |
089 | [ 85 ] = { 0.252 , 10.556222488996 } , |
090 | [ 86 ] = { 0.252 , 10.771308523409 } , |
091 | [ 87 ] = { 0.189 , 10.771308523409 } , |
092 | [ 88 ] = { 0.063 , 10.985394157663 } , |
093 | [ 89 ] = { 0.189 , 10.985394157663 } , |
094 | [ 90 ] = { 0.126 , 10.985394157663 } , |
095 | [ 91 ] = { 0.252 , 11.199479791917 } , |
096 | [ 93 ] = { 0.189 , 11.41356542617 } , |
097 | [ 94 ] = { 0.252 , 11.41356542617 } , |
098 | [ 96 ] = { 0.126 , 11.628651460584 } , |
099 | [ 98 ] = { 0.252 , 12.056822729092 } , |
100 | [ 99 ] = { 0.126 , 12.271908763505 } , |
101 | [ 100 ] = { 0.252 , 12.271908763505 } , |
LocalScript
01 | local map_encoded = require(script.Parent:FindFirstChild( "Map_Encoded" ) or script.Parent:WaitForChild( "Map_Encoded" )) |
04 | function create_note(pos) |
05 | local note = Instance.new( "ImageLabel" ); |
06 | note.Size = UDim 2. new( 0.063 , 0 , 0.011 , 0 ); |
07 | note.Position = UDim 2. new(pos, 0 , 0 , 0 ); |
08 | note.BorderSizePixel = 0 |
10 | note.BackgroundColor 3 = Color 3. new( 255 / 255 , 255 / 255 , 255 / 255 ) |
11 | note.Parent = script.Parent |
14 | local start_tick = tick() |
15 | for i = 1 , #map_encoded * #map_encoded do |
16 | local end_tick = tick() |
17 | local note = map_encoded [ note_i ] |
18 | local current_time = end_tick - start_tick |
23 | if note [ 2 ] < = current_time then |
25 | for ip, v in pairs (script.Parent:GetChildren()) do |
26 | if v:IsA( "ImageLabel" ) then |
27 | v:TweenPosition(UDim 2. new(v.Position.X.Scale, 0 , . 788 , 0 ), "Out" , "Linear" ) |
32 | game:GetService( "RunService" ).RenderStepped:wait() |
I do have an old method way of doing this but that method is inefficient, performance wise. Showing another method would be nice as this was the only thing I could think of.