Guest User

Roblox - Detailed Time Stop

a guest
Sep 17th, 2018
6,643
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.71 KB | None | 0 0
  1. print("Loaded Successfully!")
  2.     --[[Changeable Variables]]--
  3. local multiplier = 1 --Attack multiplier (default is 1)
  4. local soundlist = {
  5.     HardHit1 = "rbxassetid://565207203",
  6.     HardHit2 = "rbxassetid://541909913",
  7.     HardHit3 = "rbxassetid://541909983",
  8.     WeakHit1 = "rbxassetid://558642292",
  9.     WeakHit2 = "rbxassetid://541907812",
  10.     Slice1 = "rbxassetid://260429964",
  11.     Slice2 = "rbxassetid://260430015",
  12.     Explosion1 = "rbxassetid://138186576",
  13.     Explosion2 = "rbxassetid://157878578",
  14.     Woosh1 = "rbxassetid://541909867",
  15.     Woosh2 = "rbxassetid://541909763",
  16.     TimeSlow = "rbxassetid://615678808",
  17.     TimeStop = "rbxassetid://926382097",
  18.     TimeResume = "rbxassetid://894793352",
  19.     TimeFast = "rbxassetid://743499393",
  20.     TimeReverse = "rbxassetid://618737332",
  21.    
  22. }
  23.  
  24.     --[[Important Variables]]--
  25. local plr = game:GetService('Players').LocalPlayer
  26. local char = plr.Character
  27. local mouse = plr:GetMouse()
  28. local input = game:GetService('UserInputService')
  29. ----
  30. local joints = {"Right Shoulder", "Left Shoulder", "Right Hip", "Left Hip", "Neck", "RootJoint"}
  31. local torso,head,rootpart = char.Torso,char.Head,char.HumanoidRootPart
  32. local rs = torso["Right Shoulder"]
  33. local ls = torso["Left Shoulder"]
  34. local rh = torso["Right Hip"]
  35. local lh = torso["Left Hip"]
  36. local neck = torso.Neck
  37. local rj = rootpart["RootJoint"]
  38. ----
  39. local huge = Vector3.new(math.huge, math.huge, math.huge)
  40. local attacking = false
  41. local cananim = true
  42. local timestop = false
  43. local timeslow = false
  44. local timefast = false
  45. local reversing = false
  46. local unfreeze = {}
  47. local sounddata = {}
  48. local connections = {}
  49. local healthstuff = {}
  50.  
  51.     --[[ Functions ]]--
  52. function addattack(keycode, func)
  53.     input.InputBegan:connect(function(inp)
  54.         if inp.KeyCode == keycode and not input:GetFocusedTextBox() then
  55.             func()
  56.         end
  57.     end)
  58. end
  59. function attackend(keycode, func)
  60.     input.InputEnded:connect(function(inp)
  61.         if inp.KeyCode == keycode and not input:GetFocusedTextBox() then
  62.             func()
  63.         end
  64.     end)
  65. end
  66. function swait(t)
  67.     if t then
  68.         for i = 0, t do
  69.             game:GetService('RunService').Stepped:wait(0)
  70.         end
  71.     else
  72.         game:GetService('RunService').Stepped:wait(0)
  73.     end
  74.     return true
  75. end
  76. function fade(obj, dest, grow)
  77.     spawn(function()
  78.         local oldcf = obj.CFrame
  79.         for i = 0, 10 do
  80.             if grow then
  81.                 obj.Size = obj.Size +Vector3.new(1,1,1)
  82.                 obj.CFrame = oldcf
  83.             end
  84.             obj.Transparency = obj.Transparency +0.1
  85.             swait()
  86.         end
  87.         if dest then
  88.         obj:Destroy()
  89.         end
  90.     end)
  91. end
  92. function replacejoint(name)
  93.     local j = torso:FindFirstChild(name)
  94.     if not j then j = char.HumanoidRootPart:FindFirstChild(name) end
  95.     if j then
  96.         if true then
  97.             local already = j.Parent:FindFirstChild(j.Name.." Replacement")
  98.             local new = Instance.new("Weld")
  99.             local c0 = j.C0
  100.             local c1 = j.C1
  101.             new.Part0 = j.Part0
  102.             j.Part0 = nil
  103.             new.Name = j.Name.." Replacement"
  104.             if already then c0 = already.C0 c1 = already.C1 already:Destroy() end
  105.             new.Parent = j.Parent
  106.             new.Part1 = j.Part1
  107.             new.C0 = c0
  108.             new.C1 = c1
  109.             return new
  110.         end
  111.     end
  112. end
  113. function removejoint(name, fast)
  114.     local j = torso:FindFirstChild(name.." Replacement")
  115.     if not j then j = char.HumanoidRootPart:FindFirstChild(name.." Replacement") end
  116.     if j then
  117.         local p0 = j.Part0
  118.         if p0 ~= nil then
  119.         local c0 = j.C0
  120.         local c1 = j.C1
  121.         j:Destroy()
  122.         local new = p0:FindFirstChild(name)
  123.         local ac0 = new.C0
  124.         local ac1 = new.C1
  125.         new.Part0 = p0
  126.         new.C0 = c0
  127.         new.C1 = c1
  128.         spawn(function()
  129.             if name ~= "RootJoint" then
  130.             if not fast then
  131.             for i = 0, 0.6, 0.1 do
  132.                 new.C0 = new.C0:Lerp(ac0, 0.5)
  133.                 new.C1 = new.C1:lerp(ac1, 0.5)
  134.                 swait()
  135.             end
  136.             else
  137.                 new.C0 = new.C0:Lerp(ac0, 1)
  138.                 new.C1 = new.C1:lerp(ac1, 1)
  139.             end
  140.             end
  141.         end)
  142.         end
  143.     end
  144. end
  145. function fixalljoints(fast)
  146.     for i,v in pairs({"Right Shoulder", "Left Shoulder", "Right Hip", "Left Hip",  "Neck", "RootJoint"}) do
  147.         removejoint(v, fast)
  148.     end
  149. end
  150. function getnewjoints()
  151.     local rs = replacejoint("Right Shoulder")
  152.     local ls = replacejoint("Left Shoulder")
  153.     local rh = replacejoint("Right Hip")
  154.     local lh = replacejoint("Left Hip")
  155.     local neck = replacejoint("Neck")
  156.     local rj = replacejoint("RootJoint")
  157.     return rs,ls,rh,lh,neck,rj
  158. end
  159. function knockback(hit, force)
  160.     local bv = Instance.new("BodyVelocity")
  161.     bv.MaxForce = huge
  162.     bv.Velocity = force
  163.     bv.Parent = hit
  164.     game:GetService('Debris'):AddItem(bv, 0.15)
  165. end
  166. function soundeffect(id, volume, speed, parent, forcewait)
  167.     local func = function()
  168.         local s = LoadLibrary("RbxUtility").Create("Sound")()
  169.         s.Name = "SoundEffect"
  170.         s.Volume = volume
  171.         s.PlaybackSpeed = speed
  172.         s.SoundId = id
  173.         s.Name = "dont"
  174.         s.Looped = false
  175.         s.Parent = parent
  176.         s:Play()
  177.         repeat wait() until not s.Playing
  178.         s:Destroy()
  179.     end
  180.     if forcewait then
  181.         func()
  182.     else
  183.         spawn(func)
  184.     end
  185. end
  186. function getascendants(obj)
  187.     local par = obj
  188.     local ret = {}
  189.     pcall(function()
  190.         repeat
  191.             par = par.Parent
  192.             if par ~= nil then
  193.                 table.insert(ret, par)
  194.             end
  195.         until par == nil
  196.     end)
  197.     return ret
  198. end
  199. function findascendant(obj, class)
  200.     local par = obj
  201.     local ret = nil
  202.     pcall(function()
  203.         repeat
  204.             par = par.Parent
  205.             if par:IsA(class) then
  206.                 ret = par
  207.                 break
  208.             end
  209.         until par == nil
  210.     end)
  211.     return ret
  212. end
  213. function hurt(hit, dmg)
  214.     --pcall(function()
  215.         local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
  216.         if hum then
  217.             if hum.Parent ~= char then
  218.                 hum.Health = hum.Health - dmg
  219.                 hum.Health = hum.Health - dmg
  220.                 soundeffect(soundlist.Headshot, 1.5, 1, workspace.CurrentCamera)
  221.                 return true
  222.             end
  223.         end
  224.     --end)
  225. end
  226.     --[[ Actual script :OOOOOOOOOO ]]--
  227. addattack(Enum.KeyCode.G, function()
  228.     if not timeslow and not timefast and not reversing then
  229.         local p = Instance.new("Part")
  230.         p.Anchored = true
  231.         p.Material = "Glass"
  232.         p.Size = Vector3.new(0.1,0.1,0.1)
  233.         p.BrickColor = BrickColor.new("Toothpaste")
  234.         p.CanCollide = false
  235.         p.CFrame = char.HumanoidRootPart.CFrame
  236.         local m = Instance.new("SpecialMesh")
  237.         m.MeshType = "Sphere"
  238.         m.Parent = p
  239.         p.Parent = char
  240.         spawn(function()
  241.         for i = 1, 50 do
  242.             p.Transparency = i/50
  243.             p.Size = p.Size:Lerp(Vector3.new(40,40,40),0.1)
  244.             p.CFrame = char.HumanoidRootPart.CFrame
  245.             swait()
  246.         end
  247.         p:Destroy()
  248.         end)
  249.         if not timestop then
  250.             local s = Instance.new("Sound")
  251.             s.Volume = 3
  252.             s.Name = "dont"
  253.             s.SoundId = soundlist.TimeStop
  254.             s.Parent = char
  255.             s:Play()
  256.             dcon = workspace.DescendantAdded:connect(function(obj)
  257.             pcall(function()
  258.                 swait()
  259.                 local ok = true
  260.                 for i,v in pairs(getascendants(obj)) do
  261.                     if v.Name:lower():find("ignoremodel") then
  262.                         ok = false
  263.                     end
  264.                 end
  265.                 if obj:IsA("BasePart") and ok and not findascendant(obj, "Tool") and not findascendant(obj, "HopperBin") and not findascendant(obj, "Camera") then
  266.                     if not obj.Anchored and obj.Name ~= "HumanoidRootPart" then
  267.                         table.insert(unfreeze, obj)
  268.                         obj.Anchored = true
  269.                     end
  270.                 end
  271.                 if obj:IsA("Sound") and obj.Name ~= "dont" then
  272.                     if obj.Playing then
  273.                     obj:Pause()
  274.                     table.insert(unfreeze, obj)
  275.                     end
  276.                 end
  277.                 if obj:IsA("Humanoid") then
  278.                     local last = obj.Health
  279.                     local always = last
  280.                     local con = obj.HealthChanged:connect(function(health)
  281.                         if last-health > 0 then
  282.                         table.insert(healthstuff, {hum = obj, change = last-health})
  283.                         end
  284.                         last = health
  285.                         obj.Health = always
  286.                     end)
  287.                     table.insert(connections, con)
  288.                 end
  289.             end)
  290.         end)
  291.         for i,v in pairs(workspace:GetDescendants()) do
  292.             pcall(function()
  293.                 if v:IsA("BasePart") then
  294.                 local ok = true
  295.                 for i,e in pairs(getascendants(v)) do
  296.                     if e.Name:lower():find("ignore_model") then
  297.                         ok = false
  298.                     end
  299.                     if e:IsA("Camera") then
  300.                         ok = false
  301.                     end
  302.                 end
  303.                 if not v.Anchored and ok and v.Parent ~= char and not findascendant(v, "Camera") and not findascendant(v, "Tool") and not findascendant(v, "HopperBin") then
  304.                     local ok = true
  305.                     if v.Parent:IsA("Accessory") then ok = false end
  306.                     if ok and v.Name ~= "HumanoidRootPart" then
  307.                     v.Anchored = true
  308.                     table.insert(unfreeze, v)
  309.                     end
  310.                 end
  311.                 end
  312.             end)
  313.             pcall(function()
  314.                 if v:IsA("Sound") and v.Name ~= "dont" then
  315.                     if v.Playing then
  316.                     v:Pause()
  317.                     table.insert(unfreeze, v)
  318.                     end
  319.                 end
  320.             end)
  321.             pcall(function()
  322.                 if v:IsA("Humanoid") then
  323.                     local last = v.Health
  324.                     local always = last
  325.                     local con = v.HealthChanged:connect(function(health)
  326.                         if last-health > 0 then
  327.                         table.insert(healthstuff, {hum = v, change = last-health})
  328.                         end
  329.                         last = health
  330.                         v.Health = always
  331.                     end)
  332.                     table.insert(connections, con)
  333.                 end
  334.             end)
  335.         end
  336.         timestop = true
  337.         local cor = Instance.new("ColorCorrectionEffect")
  338.         cor.Name = "tstopef"
  339.         cor.Parent = game:GetService('Lighting')
  340.         for i = 1, 50 do
  341.             cor.Saturation = Vector3.new(cor.Saturation,0,0):Lerp(Vector3.new(-5,0,0), 0.05).X
  342.             swait()
  343.         end
  344.         game.Debris:AddItem(s, 2)
  345.     else
  346.         local s = Instance.new("Sound")
  347.         s.Volume = 7
  348.         s.Name = "dont"
  349.         s.SoundId = soundlist.TimeResume
  350.         s.Parent = char
  351.         s:Play()
  352.         local cor = game:GetService('Lighting'):FindFirstChild("tstopef")
  353.         if cor then
  354.         for i = 1, 50 do
  355.             cor.Saturation = Vector3.new(cor.Saturation,0,0):Lerp(Vector3.new(0,0,0), 0.05).X
  356.             swait()
  357.         end
  358.         cor:Destroy()
  359.         end
  360.         game.Debris:AddItem(s, 2)
  361.         timestop = false
  362.         for i,v in pairs(unfreeze) do
  363.             pcall(function()
  364.                 v.Anchored = false
  365.             end)
  366.             pcall(function()
  367.                 v:Resume()
  368.             end)
  369.         end
  370.         for i,v in pairs(connections) do
  371.             pcall(function()
  372.                 v:disconnect()
  373.             end)
  374.         end
  375.         for i,v in pairs(healthstuff) do
  376.             pcall(function()
  377.                 local hum = v.hum
  378.                 hum.Health = hum.Health - v.change
  379.                 if hum.Parent:FindFirstChild("Health") then
  380.                     pcall(function()
  381.                         hum.Parent.Health.Disabled = false
  382.                     end)
  383.                 end
  384.             end)
  385.         end
  386.         pcall(function()
  387.             dcon:disconnect()
  388.         end)
  389.                 healthstuff = {}
  390.         unfreeze = {}
  391.         end
  392.     end
  393. end)
  394. local humanoiddata = {}
  395. local bodymoverdata = {}
  396. local dcon2
  397. local connectionsdata = {}
  398. addattack(Enum.KeyCode.H, function()
  399.     if not timeslow and not timestop and not reversing then
  400.         local p = Instance.new("Part")
  401.         p.Anchored = true
  402.         p.Material = "Glass"
  403.         p.Size = Vector3.new(0.1,0.1,0.1)
  404.         p.BrickColor = BrickColor.new("Toothpaste")
  405.         p.CanCollide = false
  406.         p.CFrame = char.HumanoidRootPart.CFrame
  407.         local m = Instance.new("SpecialMesh")
  408.         m.MeshType = "Sphere"
  409.         m.Parent = p
  410.         p.Parent = char
  411.         spawn(function()
  412.         for i = 1, 50 do
  413.             p.Transparency = i/50
  414.             p.Size = p.Size:Lerp(Vector3.new(40,40,40),0.1)
  415.             p.CFrame = char.HumanoidRootPart.CFrame
  416.             swait()
  417.         end
  418.         p:Destroy()
  419.         end)
  420.         if not timefast then
  421.             timefast = true
  422.             soundeffect(soundlist.TimeFast, 1.5, 1, char)
  423.             for i,v in pairs(workspace:GetDescendants()) do
  424.                 if v:IsA("Humanoid") then
  425.                     table.insert(humanoiddata, {Hum = v, WS = v.WalkSpeed, JP = v.JumpPower})
  426.                     for _,track in pairs(v:GetPlayingAnimationTracks()) do
  427.                     end
  428.                     local con = v.AnimationPlayed:connect(function(track)
  429.                     end)
  430.                     table.insert(connections, con)
  431.                 end
  432.                 if v:IsA("BodyVelocity") then
  433.                     table.insert(bodymoverdata, {Mover = v, Vel = v.Velocity})
  434.                 end
  435.                 if v:IsA("BodyPosition") then
  436.                     table.insert(bodymoverdata, {Mover = v, Vel = v.P})
  437.                 end
  438.                 if v.Name == "HumanoidRootPart" and v:IsA("BasePart") then
  439.                 end
  440.                 if v:IsA("Sound") and v.Name ~= "dont" then
  441.                     table.insert(sounddata, {Sound = v, Speed = v.PlaybackSpeed})
  442.                 end
  443.             end
  444.             dcon2 = workspace.DescendantAdded:connect(function(v)
  445.                 swait(2)
  446.                 if v:IsA("Humanoid") then
  447.                     table.insert(humanoiddata, {Hum = v, WS = v.WalkSpeed, JP = v.JumpPower})
  448.                     for _,track in pairs(v:GetPlayingAnimationTracks()) do
  449.                         track:AdjustSpeed(1.4)
  450.                     end
  451.                     local con = v.AnimationPlayed:connect(function(track)
  452.                         track:AdjustSpeed(1.4)
  453.                     end)
  454.                     table.insert(connections, con)
  455.                 end
  456.                 if v:IsA("BodyVelocity") then
  457.                     table.insert(bodymoverdata, {Mover = v, Vel = v.Velocity})
  458.                 end
  459.                 if v:IsA("BodyPosition") then
  460.                     table.insert(bodymoverdata, {Mover = v, Vel = v.P})
  461.                 end
  462.                 if v.Name == "HumanoidRootPart" and v:IsA("BasePart") then
  463.                 end
  464.                 if v:IsA("Sound") and v.Name ~= "dont" then
  465.                     table.insert(sounddata, {Sound = v, Speed = v.PlaybackSpeed})
  466.                 end
  467.             end)
  468.         else
  469.             timefast = false
  470.             soundeffect(soundlist.TimeResume, 1.5, 1, char)
  471.             for i,v in pairs(humanoiddata) do
  472.                 pcall(function()
  473.                     v["Hum"].WalkSpeed = v["WS"]
  474.                     v["Hum"].JumpPower = v["JP"]
  475.                 end)
  476.             end
  477.             for i,v in pairs(bodymoverdata) do
  478.                 pcall(function()
  479.                     if v["Mover"]:IsA("BodyVelocity") then
  480.                         v["Mover"].Velocity = v["Vel"]
  481.                     end
  482.                     if v["Mover"]:IsA("BodyPosition") then
  483.                         v["Mover"].P = v["Vel"]
  484.                     end
  485.                 end)
  486.             end
  487.             for i,v in pairs(sounddata) do
  488.                 pcall(function()
  489.                     v["Sound"].PlaybackSpeed = v["Speed"]
  490.                 end)
  491.             end
  492.             for i,v in pairs(connections) do
  493.                 pcall(function()
  494.                     v:disconnect()
  495.                 end)
  496.             end
  497.             connections = {}
  498.             pcall(function()
  499.                 dcon2:disconnect()
  500.             end)
  501.             humanoiddata = {}
  502.         end
  503.     end
  504. end)
  505. local reversedata = {}
  506. local saved = false
  507. addattack(Enum.KeyCode.C, function()
  508.     if not timestop and not timeslow and not timefast then
  509.     if not saved then
  510.         saved = true
  511.         for i,v in pairs(workspace:GetDescendants()) do
  512.             end
  513.     else
  514.         reversing = true
  515.         saved = false
  516.         soundeffect(soundlist.TimeReverse, 2, 1, workspace)
  517.         for i = 1, 10 do
  518.             for _,v in pairs(reversedata) do
  519.                 local obj = v.obj
  520.                 local cf = v.cf                 obj.Anchored = true
  521.                 end
  522.             end
  523.             swait()
  524.         end
  525.         char.HumanoidRootPart.Velocity = Vector3.new(0,0,0)
  526.         reversedata = {}
  527.         reversing = false
  528.     end
  529.     end)
Advertisement
Add Comment
Please, Sign In to add comment