Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local replaycmd = "%replay"
- local recordcmd = "%record"
- local stopcmd = "%stop"
- local la,ra,t,h,ll,rl = {},{},{},{},{},{}
- local recording = false
- function replay()
- if #la>2 then
- local new = script.Replay:Clone()
- new.Parent = workspace.CurrentCamera
- pcall(function()
- workspace.CurrentCamera.CameraSubject = new.Torso
- end)
- while wait() do
- local all = new:GetChildren()
- for o = 1,#la do
- wait()
- for i = 1,#all do
- local sub = all[i]
- if sub.Name == "Left Arm" then
- sub.CFrame = la[o]
- elseif sub.Name == "Right Arm" then
- sub.CFrame = ra[o]
- elseif sub.Name == "Left Leg" then
- sub.CFrame = ll[o]
- elseif sub.Name == "Right Leg" then
- sub.CFrame = rl[o]
- elseif sub.Name == "Torso" then
- sub.CFrame = t[o]
- else
- if sub.Name == "Head" then
- sub.CFrame = h[o]
- end
- end
- end
- end
- wait(5)
- new:Destroy()
- pcall(function()
- workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
- end)
- return
- end
- else
- print("nothing to replay")
- return
- end
- end
- function record()
- recording = true
- la,ra,t,h,ll,rl = {},{},{},{},{},{}
- while wait() do
- if recording == true then
- game.Players.LocalPlayer.Chatted:Connect(function(msg)
- if recording == true then
- print("stopping")
- local p = game.Players.LocalPlayer
- local char = p.Character
- if string.sub(msg,1,#stopcmd) == stopcmd then
- recording = false
- end
- end
- end)
- local character = game.Players.LocalPlayer.Character
- if character then
- local all = character:GetChildren()
- if #all>1 then
- --wait()
- for i = 1,#all do
- local sub = all[i]
- if all[i].Name == "Left Arm" then
- table.insert(la,#la+1,sub.CFrame)
- elseif all[i].Name == "Right Arm" then
- table.insert(ra,#ra+1,sub.CFrame)
- elseif all[i].Name == "Torso" then
- table.insert(t,#t+1,sub.CFrame)
- elseif all[i].Name == "Left Leg" then
- table.insert(ll,#ll+1,sub.CFrame)
- elseif all[i].Name == "Right Leg" then
- table.insert(rl,#rl+1,sub.CFrame)
- else
- if all[i].Name == "Head" then
- table.insert(h,#h+1,sub.CFrame)
- end
- end
- end
- else
- break
- end
- else
- break
- end
- else
- break
- end
- end
- end
- game.Players.LocalPlayer.Chatted:Connect(function(msg)
- local p = game.Players.LocalPlayer
- local char = p.Character
- if string.sub(msg,1,#recordcmd) == recordcmd then
- print("recording")
- record()
- else
- if string.sub(msg,1,#replaycmd) == replaycmd then
- print("replaying")
- replay()
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement