Advertisement
SpacecowboyHX

Untitled

Jan 16th, 2021
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. local replaycmd = "%replay"
  2. local recordcmd = "%record"
  3. local stopcmd = "%stop"
  4. local la,ra,t,h,ll,rl = {},{},{},{},{},{}
  5. local recording = false
  6. function replay()
  7. if #la>2 then
  8. local new = script.Replay:Clone()
  9. new.Parent = workspace.CurrentCamera
  10. pcall(function()
  11. workspace.CurrentCamera.CameraSubject = new.Torso
  12. end)
  13. while wait() do
  14. local all = new:GetChildren()
  15. for o = 1,#la do
  16. wait()
  17. for i = 1,#all do
  18. local sub = all[i]
  19. if sub.Name == "Left Arm" then
  20. sub.CFrame = la[o]
  21. elseif sub.Name == "Right Arm" then
  22. sub.CFrame = ra[o]
  23. elseif sub.Name == "Left Leg" then
  24. sub.CFrame = ll[o]
  25. elseif sub.Name == "Right Leg" then
  26. sub.CFrame = rl[o]
  27. elseif sub.Name == "Torso" then
  28. sub.CFrame = t[o]
  29. else
  30. if sub.Name == "Head" then
  31. sub.CFrame = h[o]
  32. end
  33. end
  34. end
  35. end
  36. wait(5)
  37. new:Destroy()
  38. pcall(function()
  39. workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
  40. end)
  41. return
  42. end
  43. else
  44. print("nothing to replay")
  45. return
  46. end
  47. end
  48. function record()
  49. recording = true
  50. la,ra,t,h,ll,rl = {},{},{},{},{},{}
  51. while wait() do
  52. if recording == true then
  53. game.Players.LocalPlayer.Chatted:Connect(function(msg)
  54. if recording == true then
  55. print("stopping")
  56. local p = game.Players.LocalPlayer
  57. local char = p.Character
  58. if string.sub(msg,1,#stopcmd) == stopcmd then
  59. recording = false
  60. end
  61. end
  62. end)
  63. local character = game.Players.LocalPlayer.Character
  64. if character then
  65. local all = character:GetChildren()
  66. if #all>1 then
  67. --wait()
  68. for i = 1,#all do
  69. local sub = all[i]
  70. if all[i].Name == "Left Arm" then
  71. table.insert(la,#la+1,sub.CFrame)
  72. elseif all[i].Name == "Right Arm" then
  73. table.insert(ra,#ra+1,sub.CFrame)
  74. elseif all[i].Name == "Torso" then
  75. table.insert(t,#t+1,sub.CFrame)
  76. elseif all[i].Name == "Left Leg" then
  77. table.insert(ll,#ll+1,sub.CFrame)
  78. elseif all[i].Name == "Right Leg" then
  79. table.insert(rl,#rl+1,sub.CFrame)
  80. else
  81. if all[i].Name == "Head" then
  82. table.insert(h,#h+1,sub.CFrame)
  83. end
  84. end
  85. end
  86. else
  87. break
  88. end
  89. else
  90. break
  91. end
  92. else
  93. break
  94. end
  95. end
  96. end
  97.  
  98. game.Players.LocalPlayer.Chatted:Connect(function(msg)
  99. local p = game.Players.LocalPlayer
  100. local char = p.Character
  101. if string.sub(msg,1,#recordcmd) == recordcmd then
  102. print("recording")
  103. record()
  104. else
  105. if string.sub(msg,1,#replaycmd) == replaycmd then
  106. print("replaying")
  107. replay()
  108. end
  109. end
  110. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement