Advertisement
AgentVK

Untitled

Jul 22nd, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.52 KB | None | 0 0
  1. local time = tick()
  2.  
  3. local plr = game:GetService("Players").LocalPlayer
  4. local mouse,char = plr:GetMouse(),plr.Character
  5.  
  6. local amountGhosts = 5
  7.  
  8. for i,v in pairs(game:GetService("Workspace").CurrentCamera:GetChildren()) do v:Destroy() end
  9.  
  10. local toggle,cd,mcd = false,false,false
  11. local ghosts = {}
  12. local temptab = {}
  13.  
  14. char:WaitForChild("Animate"):Destroy()
  15. char.Humanoid:WaitForChild("Animator"):Destroy()
  16.  
  17. local state = "idle"
  18.  
  19. local gt = false
  20.  
  21. local gyro = Instance.new("BodyGyro",char:WaitForChild("HumanoidRootPart")) --Stops the character from glitching out on enter/exit
  22. gyro.MaxTorque = Vector3.new(0,0,0)
  23. gyro.D = 0
  24. gyro.P = 100000000
  25.  
  26.  
  27. local wCol = BrickColor.new("Really red")
  28. local wCol2 = BrickColor.new("Really black")
  29. local gCol = BrickColor.new("Toothpaste")
  30. local gCol2 = BrickColor.new("Institutional white")
  31.  
  32. function searchAll(m,clear)
  33. if clear then
  34. if clear == true then
  35. for i,v in pairs(temptab) do
  36. table.remove(temptab,1)
  37. end
  38. end
  39. end
  40. for i,v in pairs(m:GetChildren()) do
  41. if v then
  42. local s = v:Clone()
  43. for _,b in pairs(s:GetChildren()) do
  44. b:Destroy()
  45. end
  46. if s:IsA("Part") or s:IsA("WedgePart") or s:IsA("TrussPart") or s:IsA("UnionOperation") then
  47. if s.Name ~= "HumanoidRootPart" then
  48. s.Anchored = true
  49. s.CanCollide = false
  50. s.Transparency = 0.95
  51. s.TopSurface = "Smooth"
  52. s.BottomSurface = "Smooth"
  53. s.FrontSurface = "Smooth"
  54. s.RightSurface = "Smooth"
  55. s.BackSurface = "Smooth"
  56. s.LeftSurface = "Smooth"
  57. if s.Material ~= Enum.Material.Neon then
  58. if gt == true then
  59. s.BrickColor = wCol2
  60. else
  61. s.BrickColor = gCol2
  62. end
  63. else
  64. if gt == true then
  65. s.BrickColor = wCol
  66. else
  67. s.BrickColor = gCol
  68. end
  69. end
  70. for _,c in pairs(v:GetChildren()) do
  71. if c:IsA("SpecialMesh") or c:IsA("CylinderMesh") then
  72. c:Clone().Parent = s
  73. end
  74. end
  75. local objValue = Instance.new("ObjectValue",s)
  76. objValue.Name = "Target"
  77. objValue.Value = v
  78. table.insert(temptab,s)
  79. end
  80. --elseif s:IsA("CharacterMesh") then
  81. --table.insert(temptab,s)
  82. end
  83. --searchAll(v)
  84. end
  85. end
  86. return temptab
  87. end
  88.  
  89. function CreateGhost()
  90. local ghost = Instance.new("Model",game.Workspace)
  91. searchAll(char,true)
  92. ghost.Name = char.Name.."'s Ghost "..#ghosts..#plr.Name
  93. --Instance.new("Humanoid",ghost)
  94. for i,v in pairs(temptab) do
  95. v:Clone().Parent = ghost
  96. end
  97. table.insert(ghosts,ghost)
  98. end
  99.  
  100. function ClearGhosts()
  101. for i,v in pairs(ghosts) do
  102. v:Destroy()
  103. end
  104. for i,v in pairs(ghosts) do
  105. table.remove(ghosts,1)
  106. end
  107. for i,v in pairs(game:GetService("Workspace"):GetChildren()) do
  108. if string.sub(v.Name,1,#plr.Name+9) == plr.Name.."'s Ghost " then
  109. v:Destroy()
  110. end
  111. end
  112. end
  113.  
  114. Instance.new("ForceField",char).Visible = false
  115.  
  116. local e1 = Instance.new("Part",char)
  117. e1.Size = Vector3.new(0.2,0.2,0.2)
  118. e1.TopSurface = "Smooth"
  119. e1.BottomSurface = "Smooth"
  120. e1.Material = "Neon"
  121. e1.Transparency = 1
  122. e1.Anchored = true
  123. e1.CanCollide = false
  124. e1.BrickColor = gCol
  125. e1.CFrame = char.Head.CFrame * CFrame.new(0.15,0.1,-0.6)
  126. local em1 = Instance.new("SpecialMesh",e1)
  127. em1.MeshType = "Sphere"
  128. local e2 = Instance.new("Part",char)
  129. e2.Size = Vector3.new(0.2,0.2,0.2)
  130. e2.TopSurface = "Smooth"
  131. e2.BottomSurface = "Smooth"
  132. e2.Transparency = 1
  133. e2.Material = "Neon"
  134. e2.Anchored = true
  135. e2.CanCollide = false
  136. e2.BrickColor = gCol
  137. e2.CFrame = char.Head.CFrame * CFrame.new(-0.15,0.1,-0.6)
  138. local em2 = Instance.new("SpecialMesh",e2)
  139. em2.MeshType = "Sphere"
  140.  
  141. toggle = true
  142. for i=1,amountGhosts do
  143. CreateGhost()
  144. end
  145. char.Parent = game:GetService("Workspace").CurrentCamera
  146. char:FindFirstChild("Head").Transparency = 5
  147. char:FindFirstChild("Torso").Transparency = 5
  148. char:FindFirstChild("Right Arm").Transparency = 5
  149. char:FindFirstChild("Left Arm").Transparency = 5
  150. char:FindFirstChild("Right Leg").Transparency = 5
  151. char:FindFirstChild("Left Leg").Transparency = 5
  152. for i,v in pairs(char:GetChildren()) do
  153. if v:IsA("Accessory") then
  154. v:FindFirstChild("Handle").Transparency = 1
  155. end
  156. end
  157. char:FindFirstChild("Head"):FindFirstChild("face"):Destroy()
  158.  
  159. local p1 = Instance.new("Part",workspace)
  160. local m1 = Instance.new("SpecialMesh",p1)
  161. m1.MeshType = "Sphere"
  162. m1.Scale = Vector3.new(5,5,5)
  163. p1.Size = Vector3.new(1,1,1)
  164. p1.Anchored = true
  165. p1.CanCollide = false
  166. p1.TopSurface = "Smooth"
  167. p1.BottomSurface = "Smooth"
  168. p1.BrickColor = gCol
  169. p1.Material = "Neon"
  170. local p2 = Instance.new("Part",workspace)
  171. local m2 = Instance.new("SpecialMesh",p2)
  172. m2.MeshType = "Sphere"
  173. m2.Scale = Vector3.new(8,8,8)
  174. p2.Size = Vector3.new(1,1,1)
  175. p2.Anchored = true
  176. p2.CanCollide = false
  177. p2.TopSurface = "Smooth"
  178. p2.BottomSurface = "Smooth"
  179. p2.BrickColor = gCol2
  180. p2.Material = "Neon"
  181. local p3 = Instance.new("Part",workspace)
  182. local m3 = Instance.new("BlockMesh",p3)
  183. m3.Scale = Vector3.new(7,7,7)
  184. p3.Size = Vector3.new(1,1,1)
  185. p3.Transparency = 0.4
  186. p3.Anchored = true
  187. p3.CanCollide = false
  188. p3.TopSurface = "Smooth"
  189. p3.BottomSurface = "Smooth"
  190. p3.BrickColor = gCol
  191. p3.Material = "Neon"
  192. local p4 = Instance.new("Part",workspace)
  193. local m4 = Instance.new("BlockMesh",p4)
  194. m4.Scale = Vector3.new(10,10,10)
  195. p4.Size = Vector3.new(1,1,1)
  196. p4.Transparency = 0.4
  197. p4.Anchored = true
  198. p4.CanCollide = false
  199. p4.TopSurface = "Smooth"
  200. p4.BottomSurface = "Smooth"
  201. p4.BrickColor = gCol2
  202. p4.Material = "Neon"
  203. local currentframe = 0
  204. local frmR
  205.  
  206. frmR = game:GetService("RunService").RenderStepped:connect(function()
  207. currentframe = currentframe + 1
  208. if currentframe < 1*60 then
  209. p1.CFrame = char:WaitForChild("Torso").CFrame
  210. p2.CFrame = char:WaitForChild("Torso").CFrame
  211. p3.CFrame = char:WaitForChild("Torso").CFrame * CFrame.Angles(math.rad(math.random(0,360)),math.rad(math.random(0,360)),math.rad(math.random(0,360)))
  212. p4.CFrame = char:WaitForChild("Torso").CFrame * CFrame.Angles(math.rad(math.random(0,360)),math.rad(math.random(0,360)),math.rad(math.random(0,360)))
  213. m1.Scale = m1.Scale + Vector3.new(0.25,0.25,0.25)
  214. m2.Scale = m2.Scale + Vector3.new(0.25,0.25,0.25)
  215. m3.Scale = m3.Scale + Vector3.new(0.25,0.25,0.25)
  216. m4.Scale = m4.Scale + Vector3.new(0.25,0.25,0.25)
  217. p1.Transparency = p1.Transparency + (1/(1*60))
  218. p2.Transparency = p2.Transparency + (1/(1*60))
  219. p3.Transparency = p3.Transparency + (1/(1*60))
  220. p4.Transparency = p4.Transparency + (1/(1*60))
  221. else
  222. p1:Destroy()
  223. p2:Destroy()
  224. p3:Destroy()
  225. p4:Destroy()
  226. frmR:disconnect()
  227. end
  228. end)
  229.  
  230. char.Humanoid.MaxHealth = math.huge
  231. wait()
  232. char.Humanoid.Health = math.huge
  233.  
  234. --[[mouse.KeyDown:connect(function(key)
  235. if key == "r" then
  236. print("R!")
  237. if cd == false then
  238. print("No cooldown!")
  239. cd = true
  240. if toggle == false then
  241. print("Entering godmode")
  242. toggle = true
  243. Instance.new("ForceField",char)
  244. for i=1,amountGhosts do
  245. CreateGhost()
  246. end
  247. char.Parent = game:GetService("Workspace").CurrentCamera
  248. char:FindFirstChild("Head").Transparency = 1
  249. char:FindFirstChild("Torso").Transparency = 1
  250. char:FindFirstChild("Right Arm").Transparency = 1
  251. char:FindFirstChild("Left Arm").Transparency = 1
  252. char:FindFirstChild("Right Leg").Transparency = 1
  253. char:FindFirstChild("Left Leg").Transparency = 1
  254. for i,v in pairs(char:GetChildren()) do
  255. if v:IsA("Accessory") then
  256. v:FindFirstChild("Handle").Transparency = 1
  257. end
  258. end
  259. else
  260. print("Exiting godmode")
  261. toggle = false
  262. for i,v in pairs(ghosts) do
  263. v:Destroy()
  264. end
  265. char.Parent = game:GetService("Workspace")
  266. char:FindFirstChild("ForceField"):Destroy()
  267. char:FindFirstChild("Head").Transparency = 0
  268. char:FindFirstChild("Torso").Transparency = 0
  269. char:FindFirstChild("Right Arm").Transparency = 0
  270. char:FindFirstChild("Left Arm").Transparency = 0
  271. char:FindFirstChild("Right Leg").Transparency = 0
  272. char:FindFirstChild("Left Leg").Transparency = 0
  273. for i,v in pairs(char:GetChildren()) do
  274. if v:IsA("Accessory") then
  275. v:FindFirstChild("Handle").Transparency = 0
  276. end
  277. end
  278. end
  279. cd = false
  280. end
  281. end
  282. end)]]
  283.  
  284. mouse.KeyDown:connect(function(key)
  285. spawn(function()
  286. if key == "f" and toggle == true and mcd == false then
  287. if #ghosts < amountGhosts then
  288. print(#ghosts.."<")
  289. mcd = true
  290.  
  291. ClearGhosts()
  292.  
  293. for i=1,amountGhosts do
  294. CreateGhost()
  295. end
  296. local p1 = Instance.new("Part",workspace)
  297. local m1 = Instance.new("SpecialMesh",p1)
  298. m1.MeshType = "Sphere"
  299. m1.Scale = Vector3.new(7,7,7)
  300. p1.Size = Vector3.new(1,1,1)
  301. p1.Anchored = true
  302. p1.CanCollide = false
  303. p1.TopSurface = "Smooth"
  304. p1.BottomSurface = "Smooth"
  305. if gt == false then
  306. p1.BrickColor = gCol
  307. else
  308. p1.BrickColor = wCol
  309. end
  310. p1.Material = "Neon"
  311. local p2 = Instance.new("Part",workspace)
  312. local m2 = Instance.new("SpecialMesh",p2)
  313. m2.MeshType = "Sphere"
  314. m2.Scale = Vector3.new(9,9,9)
  315. p2.Size = Vector3.new(1,1,1)
  316. p2.Anchored = true
  317. p2.CanCollide = false
  318. p2.TopSurface = "Smooth"
  319. p2.BottomSurface = "Smooth"
  320. if gt == false then
  321. p2.BrickColor = gCol2
  322. else
  323. p2.BrickColor = wCol2
  324. end
  325. p2.Material = "Neon"
  326. local currentframe = 0
  327. local frmR
  328.  
  329. frmR = game:GetService("RunService").RenderStepped:connect(function()
  330. currentframe = currentframe + 1
  331. if currentframe < 0.25*60 then
  332. p1.CFrame = char:WaitForChild("Torso").CFrame
  333. p2.CFrame = char:WaitForChild("Torso").CFrame
  334. p1.Transparency = p1.Transparency + (1/(0.25*60))
  335. p2.Transparency = p2.Transparency + (1/(0.25*60))
  336. else
  337. p1:Destroy()
  338. p2:Destroy()
  339. mcd = false
  340. frmR:disconnect()
  341. end
  342. end)
  343. else
  344. mcd = true
  345.  
  346. ClearGhosts()
  347.  
  348. local p1 = Instance.new("Part",workspace)
  349. local m1 = Instance.new("SpecialMesh",p1)
  350. m1.MeshType = "Sphere"
  351. m1.Scale = Vector3.new(7,7,7)
  352. p1.Size = Vector3.new(1,1,1)
  353. p1.Anchored = true
  354. p1.CanCollide = false
  355. p1.TopSurface = "Smooth"
  356. p1.BottomSurface = "Smooth"
  357. if gt == false then
  358. p1.BrickColor = gCol
  359. else
  360. p1.BrickColor = wCol
  361. end
  362. p1.Material = "Neon"
  363. local p2 = Instance.new("Part",workspace)
  364. local m2 = Instance.new("SpecialMesh",p2)
  365. m2.MeshType = "Sphere"
  366. m2.Scale = Vector3.new(9,9,9)
  367. p2.Size = Vector3.new(1,1,1)
  368. p2.Anchored = true
  369. p2.CanCollide = false
  370. p2.TopSurface = "Smooth"
  371. p2.BottomSurface = "Smooth"
  372. if gt == false then
  373. p2.BrickColor = gCol2
  374. else
  375. p2.BrickColor = wCol2
  376. end
  377. p2.Material = "Neon"
  378. local currentframe = 0
  379. local frmR
  380.  
  381. frmR = game:GetService("RunService").RenderStepped:connect(function()
  382. currentframe = currentframe + 1
  383. if currentframe < 0.25*60 then
  384. p1.CFrame = char:WaitForChild("Torso").CFrame
  385. p2.CFrame = char:WaitForChild("Torso").CFrame
  386. p1.Transparency = p1.Transparency + (1/(0.25*60))
  387. p2.Transparency = p2.Transparency + (1/(0.25*60))
  388. else
  389. p1:Destroy()
  390. p2:Destroy()
  391. mcd = false
  392. frmR:disconnect()
  393. end
  394. end)
  395. end
  396. elseif key == "g" and toggle == true and mcd == false then
  397. if gt == true then
  398. gt = false
  399. local p1 = Instance.new("Part",workspace)
  400. local m1 = Instance.new("SpecialMesh",p1)
  401. m1.MeshType = "Sphere"
  402. m1.Scale = Vector3.new(5,5,5)
  403. p1.Size = Vector3.new(1,1,1)
  404. p1.Anchored = true
  405. p1.CanCollide = false
  406. p1.TopSurface = "Smooth"
  407. p1.BottomSurface = "Smooth"
  408. p1.BrickColor = gCol
  409. p1.Material = "Neon"
  410. local p2 = Instance.new("Part",workspace)
  411. local m2 = Instance.new("SpecialMesh",p2)
  412. m2.MeshType = "Sphere"
  413. m2.Scale = Vector3.new(8,8,8)
  414. p2.Size = Vector3.new(1,1,1)
  415. p2.Anchored = true
  416. p2.CanCollide = false
  417. p2.TopSurface = "Smooth"
  418. p2.BottomSurface = "Smooth"
  419. p2.BrickColor = gCol2
  420. p2.Material = "Neon"
  421. local p3 = Instance.new("Part",workspace)
  422. local m3 = Instance.new("BlockMesh",p3)
  423. m3.Scale = Vector3.new(7,7,7)
  424. p3.Size = Vector3.new(1,1,1)
  425. p3.Transparency = 0.4
  426. p3.Anchored = true
  427. p3.CanCollide = false
  428. p3.TopSurface = "Smooth"
  429. p3.BottomSurface = "Smooth"
  430. p3.BrickColor = gCol
  431. p3.Material = "Neon"
  432. local p4 = Instance.new("Part",workspace)
  433. local m4 = Instance.new("BlockMesh",p4)
  434. m4.Scale = Vector3.new(10,10,10)
  435. p4.Size = Vector3.new(1,1,1)
  436. p4.Transparency = 0.4
  437. p4.Anchored = true
  438. p4.CanCollide = false
  439. p4.TopSurface = "Smooth"
  440. p4.BottomSurface = "Smooth"
  441. p4.BrickColor = gCol2
  442. p4.Material = "Neon"
  443.  
  444. ClearGhosts()
  445.  
  446. for i=1,amountGhosts do
  447. CreateGhost()
  448. end
  449.  
  450. local currentframe = 0
  451. local frmR
  452.  
  453. frmR = game:GetService("RunService").RenderStepped:connect(function()
  454. currentframe = currentframe + 1
  455. if currentframe < 1*60 then
  456. p1.CFrame = char:WaitForChild("Torso").CFrame
  457. p2.CFrame = char:WaitForChild("Torso").CFrame
  458. p3.CFrame = char:WaitForChild("Torso").CFrame * CFrame.Angles(math.rad(math.random(0,360)),math.rad(math.random(0,360)),math.rad(math.random(0,360)))
  459. p4.CFrame = char:WaitForChild("Torso").CFrame * CFrame.Angles(math.rad(math.random(0,360)),math.rad(math.random(0,360)),math.rad(math.random(0,360)))
  460. m1.Scale = m1.Scale + Vector3.new(0.25,0.25,0.25)
  461. m2.Scale = m2.Scale + Vector3.new(0.25,0.25,0.25)
  462. m3.Scale = m3.Scale + Vector3.new(0.25,0.25,0.25)
  463. m4.Scale = m4.Scale + Vector3.new(0.25,0.25,0.25)
  464. p1.Transparency = p1.Transparency + (1/(1*60))
  465. p2.Transparency = p2.Transparency + (1/(1*60))
  466. p3.Transparency = p3.Transparency + (1/(1*60))
  467. p4.Transparency = p4.Transparency + (1/(1*60))
  468. else
  469. p1:Destroy()
  470. p2:Destroy()
  471. p3:Destroy()
  472. p4:Destroy()
  473. frmR:disconnect()
  474. end
  475. end)
  476. else
  477. gt = true
  478. local p1 = Instance.new("Part",workspace)
  479. local m1 = Instance.new("SpecialMesh",p1)
  480. m1.MeshType = "Sphere"
  481. m1.Scale = Vector3.new(5,5,5)
  482. p1.Size = Vector3.new(1,1,1)
  483. p1.Anchored = true
  484. p1.CanCollide = false
  485. p1.TopSurface = "Smooth"
  486. p1.BottomSurface = "Smooth"
  487. p1.BrickColor = wCol
  488. p1.Material = "Neon"
  489. local p2 = Instance.new("Part",workspace)
  490. local m2 = Instance.new("SpecialMesh",p2)
  491. m2.MeshType = "Sphere"
  492. m2.Scale = Vector3.new(8,8,8)
  493. p2.Size = Vector3.new(1,1,1)
  494. p2.Anchored = true
  495. p2.CanCollide = false
  496. p2.TopSurface = "Smooth"
  497. p2.BottomSurface = "Smooth"
  498. p2.BrickColor = wCol2
  499. p2.Material = "Neon"
  500. local p3 = Instance.new("Part",workspace)
  501. local m3 = Instance.new("BlockMesh",p3)
  502. m3.Scale = Vector3.new(7,7,7)
  503. p3.Size = Vector3.new(1,1,1)
  504. p3.Transparency = 0.4
  505. p3.Anchored = true
  506. p3.CanCollide = false
  507. p3.TopSurface = "Smooth"
  508. p3.BottomSurface = "Smooth"
  509. p3.BrickColor = wCol
  510. p3.Material = "Neon"
  511. local p4 = Instance.new("Part",workspace)
  512. local m4 = Instance.new("BlockMesh",p4)
  513. m4.Scale = Vector3.new(10,10,10)
  514. p4.Size = Vector3.new(1,1,1)
  515. p4.Transparency = 0.4
  516. p4.Anchored = true
  517. p4.CanCollide = false
  518. p4.TopSurface = "Smooth"
  519. p4.BottomSurface = "Smooth"
  520. p4.BrickColor = wCol2
  521. p4.Material = "Neon"
  522.  
  523. ClearGhosts()
  524.  
  525. for i=1,amountGhosts do
  526. CreateGhost()
  527. end
  528.  
  529. local currentframe = 0
  530. local frmR
  531.  
  532. frmR = game:GetService("RunService").RenderStepped:connect(function()
  533. currentframe = currentframe + 1
  534. if currentframe < 1*60 then
  535. p1.CFrame = char:WaitForChild("Torso").CFrame
  536. p2.CFrame = char:WaitForChild("Torso").CFrame
  537. p3.CFrame = char:WaitForChild("Torso").CFrame * CFrame.Angles(math.rad(math.random(0,360)),math.rad(math.random(0,360)),math.rad(math.random(0,360)))
  538. p4.CFrame = char:WaitForChild("Torso").CFrame * CFrame.Angles(math.rad(math.random(0,360)),math.rad(math.random(0,360)),math.rad(math.random(0,360)))
  539. m1.Scale = m1.Scale + Vector3.new(0.25,0.25,0.25)
  540. m2.Scale = m2.Scale + Vector3.new(0.25,0.25,0.25)
  541. m3.Scale = m3.Scale + Vector3.new(0.25,0.25,0.25)
  542. m4.Scale = m4.Scale + Vector3.new(0.25,0.25,0.25)
  543. p1.Transparency = p1.Transparency + (1/(1*60))
  544. p2.Transparency = p2.Transparency + (1/(1*60))
  545. p3.Transparency = p3.Transparency + (1/(1*60))
  546. p4.Transparency = p4.Transparency + (1/(1*60))
  547. else
  548. p1:Destroy()
  549. p2:Destroy()
  550. p3:Destroy()
  551. p4:Destroy()
  552. frmR:disconnect()
  553. end
  554. end)
  555. end
  556. end
  557. end)
  558. end)
  559.  
  560. local frm = 0
  561.  
  562. local toRemove = {}
  563.  
  564. game:GetService("RunService").RenderStepped:connect(function()
  565. frm = frm + 1
  566. if char.Parent == game:GetService("Workspace").CurrentCamera then
  567.  
  568. e1.CFrame = char.Head.CFrame * CFrame.new(0.15,0.1,-0.55)
  569. e2.CFrame = char.Head.CFrame * CFrame.new(-0.15,0.1,-0.55)
  570.  
  571. local delay = 0.9
  572.  
  573. for i,v in pairs(ghosts) do
  574. for _,b in pairs(v:GetChildren()) do
  575. if b:IsA("Part") or b:IsA("WedgePart") or b:IsA("TrussPart") or b:IsA("UnionOperation") then
  576. b.CFrame = b.CFrame:lerp(b:FindFirstChild("Target").Value.CFrame,delay)
  577. end
  578. end
  579. delay = delay - (0.5/(#ghosts+1))
  580. end
  581.  
  582. --[[if math.floor(frm/8) == frm/8 then
  583. local isub = 0
  584. for i,v in pairs(ghosts) do
  585. if #v:GetChildren() < 6 then
  586. v:Destroy()
  587. table.remove(ghosts,i - isub)
  588. isub = isub + 1
  589. CreateGhost()
  590. end
  591. end
  592. end]]
  593. end
  594.  
  595. --Animation states
  596.  
  597. local ray = Ray.new(char.HumanoidRootPart.CFrame.p, Vector3.new(0,-3,0).unit*4)
  598. local part,pos,normal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(ray,ghosts,false,true)
  599.  
  600. if state ~= "busy" then
  601. if char.HumanoidRootPart.Velocity.Magnitude <= 0.5 then
  602. state = "idle"
  603. elseif char.HumanoidRootPart.Velocity.Magnitude > 0.5 then
  604. state = "running"
  605. --[[elseif char.HumanoidRootPart.Velocity.Y < 0.1 and not part then
  606. state = "falling"
  607. elseif char.HumanoidRootPart.Velocity.Y >= 0.1 and not part then
  608. state = "jumping"]]
  609. end
  610. char.Humanoid.WalkSpeed = 50
  611. char.Humanoid.JumpPower = 70
  612. end
  613.  
  614. --Actual animations
  615.  
  616. if state == "idle" then
  617. char.HumanoidRootPart.RootJoint.C0 = char.HumanoidRootPart.RootJoint.C0:lerp(CFrame.new(0,1 + (math.cos(tick())/5),0) * CFrame.Angles(math.rad(80 + math.cos(tick())*4),math.rad(180),math.rad(0)),0.06)
  618. char.Torso["Right Hip"].C0 = char.Torso["Right Hip"].C0:lerp(CFrame.new(0.5,-0.1 + (math.cos((tick())*2)/10),-0.2) * CFrame.Angles(math.rad(-20),math.rad(0),math.rad(0)),0.06)
  619. char.Torso["Left Hip"].C0 = char.Torso["Left Hip"].C0:lerp(CFrame.new(-0.5,-0.5 + (math.cos((tick()-0.5)*2)/6),0.3) * CFrame.Angles(math.rad(-10),math.rad(0),math.rad(0)),0.06)
  620. char.Torso["Right Shoulder"].C0 = char.Torso["Right Shoulder"].C0:lerp(CFrame.new(1.5,0.43 + (math.cos((tick()-0.5)*1.5)/30),-0.6) * CFrame.Angles(math.rad(math.cos((tick())*2)*10),math.rad(0),math.rad(math.cos(tick()/3)*3)),0.06)
  621. char.Torso["Left Shoulder"].C0 = char.Torso["Left Shoulder"].C0:lerp(CFrame.new(-1.5,0.3 + (math.cos((tick()-0.5)*1.5)/30),-0.6) * CFrame.Angles(math.rad(-15 + math.cos((tick()))*7),math.rad(0),math.rad(math.cos(tick()/2)*4)),0.06)
  622. char.Torso.Neck.C0 = char.Torso.Neck.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(90 + math.cos(tick()*1.5)*6),math.rad(180),math.rad(0)),0.06)
  623. elseif state == "running" then
  624. char.HumanoidRootPart.RootJoint.C0 = char.HumanoidRootPart.RootJoint.C0:lerp(CFrame.new(0,1 + (math.cos(tick())/5),0) * CFrame.Angles(math.rad(65 + math.cos(tick())*4),math.rad(180),math.rad(-char.HumanoidRootPart.RotVelocity.Y*10)),0.06)
  625. char.Torso["Right Hip"].C0 = char.Torso["Right Hip"].C0:lerp(CFrame.new(0.5,-0.1 + (math.cos((tick())*2)/10),-0.2) * CFrame.Angles(math.rad(-20),math.rad(0),math.rad(0)),0.06)
  626. char.Torso["Left Hip"].C0 = char.Torso["Left Hip"].C0:lerp(CFrame.new(-0.5,-0.5 + (math.cos((tick()-0.5)*2)/6),0.3) * CFrame.Angles(math.rad(-10),math.rad(0),math.rad(0)),0.06)
  627. char.Torso["Right Shoulder"].C0 = char.Torso["Right Shoulder"].C0:lerp(CFrame.new(1.5,0.70 + (math.cos((tick()-0.5)*1.5)/30),-0.4) * CFrame.Angles(math.rad(50 + math.cos((tick())*2)*10),math.rad(0),math.rad(math.cos(tick()/3)*3)),0.06)
  628. char.Torso["Left Shoulder"].C0 = char.Torso["Left Shoulder"].C0:lerp(CFrame.new(-1.5,0.3 + (math.cos((tick()-0.5)*1.5)/30),-0.4) * CFrame.Angles(math.rad(-35 + math.cos((tick()))*7),math.rad(0),math.rad(math.cos(tick()/2)*4)),0.06)
  629. char.Torso.Neck.C0 = char.Torso.Neck.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(90 + math.cos(tick()*1.5)*6),math.rad(180),math.rad(0)),0.06)
  630. end
  631. end)
  632.  
  633. char.Humanoid.Died:connect(function()
  634. toggle = false
  635.  
  636. ClearGhosts()
  637.  
  638. char.Parent = game.Workspace
  639. char.Parent = game:GetService("Workspace")
  640. char:FindFirstChild("ForceField"):Destroy()
  641. char:FindFirstChild("Head").Transparency = 0
  642. char:FindFirstChild("Torso").Transparency = 0
  643. char:FindFirstChild("Right Arm").Transparency = 0
  644. char:FindFirstChild("Left Arm").Transparency = 0
  645. char:FindFirstChild("Right Leg").Transparency = 0
  646. char:FindFirstChild("Left Leg").Transparency = 0
  647. for i,v in pairs(char:GetChildren()) do
  648. if v:IsA("Accessory") then
  649. v:FindFirstChild("Handle").Transparency = 0
  650. end
  651. end
  652. for i,v in pairs(game:GetService("Workspace").CurrentCamera:GetChildren()) do v:Destroy() end
  653. plr:LoadCharacter()
  654. end)
  655.  
  656. local msgidGlob = 0
  657. local state = true
  658. local font = "Arcade"
  659. local tcol = Color3.fromRGB(255,217,0)
  660. local tscol = Color3.fromRGB(0,0,0)
  661. local fsiz = 28
  662. local tr = true
  663. local tsr = false
  664. local fade = 2
  665.  
  666. local p = Instance.new("Part",game.Workspace)
  667. p.Size = Vector3.new(0.2,0.2,0.2)
  668. p.Transparency = 1
  669. p.Anchored = true
  670. p.CanCollide = false
  671. p.Name = "Msg"
  672. p.CFrame = plr.Character:WaitForChild("Head").CFrame + Vector3.new(0,2.25,0)
  673.  
  674. local r = 255
  675. local b = 0
  676. local g = 0
  677.  
  678. plr.Chatted:connect(function(c)
  679. msgidGlob = msgidGlob + 1
  680. local curMsgId = msgidGlob
  681. if string.lower(c) == "!disable" then
  682. state = false
  683. elseif string.lower(c) == "!enable" then
  684. state = true
  685. elseif string.lower(string.sub(c,1,6)) == "!font " then
  686. local old = font
  687. font = string.sub(c,7,#c) or old
  688. elseif string.lower(string.sub(c,1,8)) == "!tcolor " then
  689. if string.lower(string.sub(c,9,#c)) == "rainbow" then
  690. tr = true
  691. else
  692. tr = false
  693. local old = tcol
  694. tcol = Color3.fromRGB(string.sub(c,9,11),string.sub(c,13,15),string.sub(c,17,19)) or old
  695. end
  696. elseif string.lower(string.sub(c,1,9)) == "!tscolor " then
  697. if string.sub(c,10,#c) == "rainbow" then
  698. tsr = true
  699. else
  700. tsr = false
  701. local old = tscol
  702. tscol = Color3.fromRGB(string.sub(c,10,12),string.sub(c,14,16),string.sub(c,18,20)) or old
  703. end
  704. elseif string.lower(string.sub(c,1,6)) == "!size " then
  705. local old = fsiz
  706. fsiz = string.sub(c,7,#c) or old
  707. elseif string.lower(string.sub(c,1,6)) == "!fade " then
  708. local old = fade
  709. fade = string.sub(c,7,#c) or old
  710. end
  711. if plr.Character and state == true then
  712. if plr.Character:FindFirstChild("Head") then
  713. for i,v in pairs(p:GetChildren()) do
  714. if v:IsA("BillboardGui") and v.Name == "J2CMSG" then
  715. v:Destroy()
  716. end
  717. end
  718. local bbgui = Instance.new("BillboardGui",p)
  719. bbgui.Name = "J2CMSG"
  720. bbgui.AlwaysOnTop = true
  721. bbgui.ExtentsOffsetWorldSpace = Vector3.new(0,4.5,0)
  722. bbgui.Size = UDim2.new(0.2,0,0.14,0)
  723. local tl = Instance.new("TextLabel",bbgui)
  724. tl.BackgroundTransparency = 1
  725. tl.BorderSizePixel = 0
  726. tl.Size = UDim2.new(1,0,10,0)
  727. tl.Position = UDim2.new(0,0,-5,0)
  728. tl.Font = font or "SciFi"
  729. tl.FontSize = "Size"..fsiz or "Size36"
  730. tl.TextColor3 = tcol
  731. tl.TextScaled = false
  732. tl.TextWrapped = false
  733. tl.TextStrokeColor3 = tscol
  734. tl.TextStrokeTransparency = 0
  735.  
  736. game:GetService("RunService").RenderStepped:connect(function()
  737. if tr then
  738. if tl.Parent ~= nil then
  739. tl.TextColor3 = Color3.fromRGB(r,g,b)
  740. end
  741. end
  742. end)
  743.  
  744. for i=1,#c do
  745. if msgidGlob == curMsgId then
  746. tl.Text = string.sub(c,1,i)
  747. if string.sub(c,i,i) ~= " " then
  748. local s = Instance.new("Sound",p)
  749. s.SoundId = "rbxassetid://418252437"
  750. s.Volume = 1
  751. s.Pitch = 1
  752. s:Play()
  753. game.Debris:AddItem(s,2)
  754. end
  755. wait()
  756. end
  757. end
  758. wait(fade)
  759. if msgidGlob == curMsgId then
  760. for i=1,10 do
  761. if msgidGlob == curMsgId then
  762. tl.TextTransparency = tl.TextTransparency + 0.1
  763. tl.TextStrokeTransparency = tl.TextStrokeTransparency + 0.1
  764. tl.Position = tl.Position + UDim2.new(0,0,0,-3)
  765. wait()
  766. end
  767. end
  768. if msgidGlob == curMsgId then
  769. bbgui:Destroy()
  770. end
  771. end
  772. end
  773. end
  774. end)
  775.  
  776. coroutine.resume(coroutine.create(function()
  777. while wait() do
  778. for i=0,255,10 do g = i wait() end
  779. for i=255,0,-10 do r = i wait() end
  780. for i=0,255,10 do b = i wait() end
  781. for i=255,0,-10 do g = i wait() end
  782. for i=0,255,10 do r = i wait() end
  783. for i=255,0,-10 do b = i wait() end
  784. end
  785. end))
  786.  
  787. game:GetService("RunService").RenderStepped:connect(function()
  788. if p.Parent ~= nil then
  789. p.CFrame = p.CFrame:lerp(plr.Character:WaitForChild("Head").CFrame + Vector3.new(0,2.25,0),0.16)
  790. else
  791. p = Instance.new("Part",game.Workspace)
  792. p.Size = Vector3.new(0.2,0.2,0.2)
  793. p.Transparency = 1
  794. p.Anchored = true
  795. p.CanCollide = false
  796. p.Name = "Msg"
  797. p.CFrame = plr.Character:WaitForChild("Head").CFrame + Vector3.new(0,2.25,0)
  798. end
  799. end)
  800.  
  801. print("Ghost loaded! Time elapsed: "..tick() - time)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement