Advertisement
ajcooper2003

Untitled

Sep 26th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.05 KB | None | 0 0
  1. RecordParts = {}
  2. RecordLocations = {}
  3. RecordFrame = 0
  4. RecordDelay = 0
  5. RecordOn = false
  6. RecordRewindFrame = 0
  7. RecordRewindOn = false
  8. RecordPlayOn = false
  9. RecordDebug = true
  10.  
  11.  
  12. function RecordFind(Part)
  13. if Part == nil then Part = Workspace end
  14. for _, Children in pairs(Part:GetChildren()) do
  15. if pcall(function() local x = Children.CFrame end) == true then
  16. if Children.Anchored == false then
  17. table.insert(RecordParts, Children)
  18. table.insert(RecordLocations, {})
  19. end
  20. end
  21. RecordFind(Children)
  22. end
  23. end
  24.  
  25.  
  26. function RecordStart()
  27. RecordStop()
  28. RecordOn = true
  29. coroutine.resume(coroutine.create(function()
  30. while RecordOn == true do
  31. if RecordDebug == true then
  32. local Hint = nil
  33. if script:FindFirstChild("Message") == nil then Hint = Instance.new("Message", script) else Hint = script.Message end
  34. Hint.Text = "Mode: Record | Frame: " ..RecordFrame.. " | Delay: " ..RecordDelay.. " | Recorded parts: " ..#RecordParts.. " | Total positions: " ..#RecordParts * RecordFrame
  35. end
  36. for i = 1, #RecordParts do
  37. table.insert(RecordLocations[i], RecordParts[i].CFrame)
  38. end
  39. RecordFrame = RecordFrame + 1
  40. RecordRewindFrame = RecordFrame
  41. wait(RecordDelay)
  42. end
  43. end))
  44. end
  45.  
  46.  
  47. function RecordRewind()
  48. RecordStop()
  49. RecordFreeze()
  50. RecordRewindOn = true
  51. for i = 1, #RecordParts do
  52. RecordParts[i].Velocity = Vector3.new(0, 0, 0)
  53. RecordParts[i].Anchored = true
  54. end
  55. coroutine.resume(coroutine.create(function()
  56. while RecordRewindOn == true do
  57. if RecordDebug == true then
  58. local Hint = nil
  59. if script:FindFirstChild("Message") == nil then Hint = Instance.new("Message", script) else Hint = script.Message end
  60. Hint.Text = "Mode: Rewind | Frame: " ..RecordRewindFrame.. "/" ..RecordFrame.. " | Delay: " ..RecordDelay.. " | Recorded parts: " ..#RecordParts.. " | Total positions: " ..#RecordParts * RecordFrame
  61. end
  62. for i = 1, #RecordParts do
  63. RecordParts[i].Velocity = Vector3.new(0, 0, 0)
  64. RecordParts[i].CFrame = RecordLocations[i][RecordRewindFrame]
  65. end
  66. RecordRewindFrame = RecordRewindFrame - 1
  67. if RecordRewindFrame <= 0 then
  68. RecordRewindFrame = 1
  69. RecordStop()
  70. RecordFreeze()
  71. end
  72. wait(RecordDelay)
  73. end
  74. end))
  75. end
  76.  
  77.  
  78. function RecordPlay()
  79. RecordStop()
  80. RecordFreeze()
  81. RecordPlayOn = true
  82. coroutine.resume(coroutine.create(function()
  83. while RecordPlayOn == true do
  84. if RecordDebug == true then
  85. local Hint = nil
  86. if script:FindFirstChild("Message") == nil then Hint = Instance.new("Message", script) else Hint = script.Message end
  87. Hint.Text = "Mode: Play | Frame: " ..RecordRewindFrame.. "/" ..RecordFrame.. " | Delay: " ..RecordDelay.. " | Recorded parts: " ..#RecordParts.. " | Total positions: " ..#RecordParts * RecordFrame
  88. end
  89. for i = 1, #RecordParts do
  90. RecordParts[i].Velocity = Vector3.new(0, 0, 0)
  91. RecordParts[i].CFrame = RecordLocations[i][RecordRewindFrame]
  92. end
  93. RecordRewindFrame = RecordRewindFrame + 1
  94. if RecordRewindFrame >= RecordFrame then
  95. RecordRewindFrame = RecordFrame
  96. RecordStop()
  97. RecordFreeze()
  98. end
  99. wait(RecordDelay)
  100. end
  101. end))
  102. end
  103.  
  104.  
  105. function RecordFreeze()
  106. for i = 1, #RecordParts do
  107. RecordParts[i].Velocity = Vector3.new(0, 0, 0)
  108. RecordParts[i].Anchored = true
  109. end
  110. if RecordDebug == true then
  111. local Hint = nil
  112. if script:FindFirstChild("Message") == nil then Hint = Instance.new("Message", script) else Hint = script.Message end
  113. Hint.Text = "Mode: Frozen (Pause) | Frame: " ..RecordRewindFrame.. "/" ..RecordFrame.. " | Delay: " ..RecordDelay.. " | Recorded parts: " ..#RecordParts.. " | Total positions: " ..#RecordParts * RecordFrame
  114. end
  115. end
  116.  
  117.  
  118. function RecordUnfreeze()
  119. for i = 1, #RecordParts do
  120. RecordParts[i]:MakeJoints()
  121. RecordParts[i].Velocity = Vector3.new(0, 0, 0)
  122. RecordParts[i].Anchored = false
  123. end
  124. if RecordDebug == true then
  125. local Hint = nil
  126. if script:FindFirstChild("Message") == nil then Hint = Instance.new("Message", script) else Hint = script.Message end
  127. Hint.Text = "Mode: None | Delay: " ..RecordDelay.. " | Recorded parts: " ..#RecordParts.. " | Total positions: " ..#RecordParts * RecordFrame
  128. end
  129. end
  130.  
  131.  
  132. function RecordStop()
  133. RecordOn = false
  134. RecordRewindOn = false
  135. RecordPlayOn = false
  136. end
  137.  
  138.  
  139. function RecordClear()
  140. RecordStop()
  141. RecordUnfreeze()
  142. for i = 1, #RecordParts do
  143. RecordParts[i] = nil
  144. end
  145. for i = 1, #RecordLocations do
  146. for x = 1, #RecordLocations[i] do
  147. RecordLocations[i][x] = nil
  148. end
  149. RecordLocations[i] = nil
  150. end
  151. RecordParts = {}
  152. RecordLocations = {}
  153. RecordFrame = 0
  154. RecordRewindFrame = 0
  155. if RecordDebug == true then
  156. local Hint = nil
  157. if script:FindFirstChild("Message") == nil then Hint = Instance.new("Message", script) else Hint = script.Message end
  158. Hint.Text = "Mode: None | Record cleared."
  159. end
  160. end
  161.  
  162.  
  163. while true do
  164. RecordFind()
  165. RecordStart()
  166. wait(25)
  167. RecordStop()
  168. RecordFreeze()
  169. wait(1)
  170. RecordRewind()
  171. wait(26)
  172. RecordPlay()
  173. wait(26)
  174. RecordRewind()
  175. wait(26)
  176. RecordClear()
  177. wait(5)
  178. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement