Advertisement
AndrewTheMaster

time box

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