Advertisement
Kronola

[ROBLOX] Death Bending Lua Script

Aug 3rd, 2016
5,715
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.62 KB | None | 0 0
  1. -- Player declarations
  2. local player = game.Players.Kronola
  3. local char = player.Character
  4.  
  5. -- Body parts
  6. local torso = char.Torso
  7.  
  8. -- Tool declarations
  9. local mouseDown = false
  10. local keysDown = {}
  11.  
  12. -- Earth bending declarations
  13. local raisingEarth = false
  14. local raisingTower = false
  15. local wall = false
  16. local groundAttack = false
  17. local lastTower = nil
  18. local disabled = {}
  19. local frames = {}
  20. local parts = {}
  21. local Taunts = {"Die already!", "DIE, DIE, DIE!", "HRRAAAA!", "I told you it's useless!", "You will not be the first to die by my hand!", "You will suffer!", "Don't try to evade the inevitable!", "I will tear you apart!","You are pathetic!","You will never defeat me!","I AM GOD!"}
  22. local raisechats = {"I will make you realize the depth of my power, even if I have to grind your body into dust!","I suggest you run.", "Now you're just pissing me off.", "Hmph.", "It's useless.",".....", "Your life ends here!","Foolish!","Do you know who I am?","What stupidity.","Hmm.","Hmph. Your confidence is annoying.","You cannot kill a god."}
  23.  
  24. -- Main
  25. function main(mouse)
  26. while true do wait(1/30)
  27. local look = CFrame.new(torso.Position, torso.Position + mouse.Hit.lookVector)
  28.  
  29. -- Reset parts
  30. parts = {}
  31.  
  32. -- Get parts
  33. for x = -20, 20, 10 do
  34. for y = -20, 20, 10 do
  35. for z = -30, -10, 10 do
  36. local pos = look * Vector3.new(x, y, z)
  37. getPartsInRegion3(
  38. Region3.new(
  39. pos + Vector3.new(1,1,1)*-9,
  40. pos + Vector3.new(1,1,1)* 9
  41. ),
  42. parts
  43. )
  44. end
  45. end
  46. end
  47.  
  48. -- Mouse down
  49. if mouseDown then
  50. -- Create dif and bodies
  51. for _, part in pairs(parts) do
  52. if part.Name == "Earth" and not disabled[part] then
  53. if not frames[part] and part ~= lastTower then
  54. frames[part] = look:toObjectSpace(part.CFrame)
  55.  
  56. part:ClearAllChildren()
  57. part.Anchored = false
  58.  
  59. -- Create bodies
  60. createBody("Position", part)
  61. createBody("Gyro", part)
  62. end
  63. end
  64. end
  65.  
  66. -- Move bodies
  67. for part in pairs(frames) do
  68. local bodyPos = part:FindFirstChild("BodyPosition")
  69. local bodyGyr = part:FindFirstChild("BodyGyro")
  70.  
  71. -- Bodies exist
  72. if bodyPos and bodyGyr then
  73. local dif = look * frames[part]
  74.  
  75. bodyPos.position = dif.p
  76. bodyGyr.cframe = dif
  77. else
  78. frames[part] = nil
  79. end
  80. end
  81. else
  82. for part in pairs(frames) do
  83. if part.Name == "Earth" then
  84. frames[part] = nil
  85.  
  86. part:ClearAllChildren()
  87. end
  88. end
  89. end
  90. end
  91. end
  92.  
  93. -- On key change
  94. function onKeyChange(mouse, key, state)
  95. -- Raise earth
  96. if key == "e" and state and not raisingEarth then
  97. game:GetService("Chat"):Chat(char.Head, raisechats[math.random(1,#raisechats)], Enum.ChatColor.Red)
  98. raisingEarth = true
  99. while keysDown[key] do
  100. local torsoY = torso.Position.y + 3
  101. local pos = planeY(torso.Position, 0.4 - 4/2)
  102. local dir = planeY(mouse.Hit.lookVector).unit
  103. local frame = CFrame.new(pos, pos + dir) * CFrame.new(r(-10, 10), 0, r(-20, -5))
  104.  
  105. -- Create earth part
  106. local part = createEarth(workspace)
  107. part.Anchored = true
  108. part.Size = Vector3.new(4, 4, 4)
  109. disabled[part] = true
  110.  
  111. -- Raise earth
  112. for i = 1, 4 do i = i/4
  113. part.CFrame = frame * CFrame.new(0, (torsoY - frame.y)*i, 0)
  114. wait(1/10000000)
  115. if not part.Anchored then
  116. break
  117. end
  118. end
  119.  
  120. disabled[part] = nil
  121. part.Anchored = false
  122.  
  123. wait(1/100)
  124. end
  125. raisingEarth = false
  126.  
  127.  
  128.  
  129.  
  130.  
  131. elseif key == "c" and state and not raisingEarth then
  132. game:GetService("Chat"):Chat(char.Head, raisechats[math.random(1,#raisechats)], Enum.ChatColor.Red)
  133. raisingEarth = true
  134. while keysDown[key] do
  135. local torsoY = torso.Position.y + 3
  136. local pos = planeY(torso.Position, 0.4 - 4/2)
  137. local dir = planeY(mouse.Hit.lookVector).unit
  138. local frame = CFrame.new(pos, pos + dir) * CFrame.new(r(-10, 10), 0, r(-20, -5))
  139.  
  140. -- Create earth part
  141. local part = createEarth(workspace)
  142. part.Anchored = true
  143. part.Size = Vector3.new(2, 2, 2)
  144. disabled[part] = true
  145.  
  146. -- Raise earth
  147. for i = 1, 4 do i = i/4
  148. part.CFrame = frame * CFrame.new(0, (torsoY - frame.y)*i, 0)
  149. wait(1/10000000)
  150. if not part.Anchored then
  151. break
  152. end
  153. end
  154.  
  155. disabled[part] = nil
  156. part.Anchored = false
  157.  
  158. wait(1/100)
  159. end
  160. raisingEarth = false
  161.  
  162.  
  163.  
  164. -- Push earth
  165. elseif key == "f" and state then
  166. game:GetService("Chat"):Chat(char.Head, Taunts[math.random(1,#Taunts)], Enum.ChatColor.Red)
  167. for _, part in pairs(parts) do
  168. if part.Name == "Earth" and part ~= lastTower then
  169. part:ClearAllChildren()
  170. part.Anchored = false
  171.  
  172. -- Add force
  173. local bodyForce = createBody("Force", part)
  174. bodyForce.force = mouse.Hit.lookVector*1.5e4 * part:GetMass()
  175.  
  176. game.Debris:AddItem(bodyForce, 1/30)
  177.  
  178. -- Disable part
  179. disabled[part] = true
  180. delay(1, function()
  181. disabled[part] = nil
  182. end)
  183. end
  184. end
  185.  
  186. -- Monster Ability
  187. elseif key == "m" and state then
  188. wait(.1)
  189. f = Instance.new("Fire")
  190. f.Parent = char.Head
  191. f.Color = Color3.new(0.7,0.5,0.9)
  192. f.Size = 5
  193. f.Heat = 5
  194. wait(.1)
  195. g = Instance.new("Fire")
  196. g.Parent = char["Right Arm"]
  197. g.Color = Color3.new(0.7,0.5,0.9)
  198. g.Size = 5
  199. g.Heat = 5
  200. wait(.1)
  201. h = Instance.new("Fire")
  202. h.Parent = char["Left Arm"]
  203. h.Color = Color3.new(0.7,0.5,0.9)
  204. h.Size = 5
  205. h.Heat = 5
  206. wait(.1)
  207. z = Instance.new("Sound")
  208. z.Parent = game.Workspace
  209. z.SoundId = "http://www.roblox.com/asset/?id=159365911"
  210. z.Looped = false
  211. z.Volume = 1
  212. z.Pitch = 0.65
  213. wait(1.8)
  214. game:GetService("Chat"):Chat(char.Head, "Hmph.", Enum.ChatColor.Red)
  215. wait(3.4)
  216. game:GetService("Chat"):Chat(char.Head, "This has become a pointless battle.", Enum.ChatColor.Red)
  217. wait(2.4)
  218. game:GetService("Chat"):Chat(char.Head, "I will end this quickly", Enum.ChatColor.Red)
  219. wait(.1)
  220. z:Play()
  221. char.Humanoid.MaxHealth = 900000000
  222. wait(1)
  223. char.Humanoid.Health = 900000000
  224. wait(182)
  225. char.Humanoid.MaxHealth = 600
  226. z:Remove()
  227. f:Remove()
  228. g:Remove()
  229. h:Remove()
  230.  
  231. -- N-Rage
  232. elseif key == "n" and state then
  233. c = Instance.new("Sound")
  234. c.Parent = game.Workspace
  235. c.SoundId = "http://www.roblox.com/asset/?id=157747165"
  236. c.Looped = false
  237. c.Volume = 1
  238. c.Pitch = .7
  239. wait(1.8)
  240. game:GetService("Chat"):Chat(char.Head, "What the hell was that?", Enum.ChatColor.Red)
  241. wait(2)
  242. game:GetService("Chat"):Chat(char.Head, "Did you actually believe you could harm me?", Enum.ChatColor.Red)
  243. wait(2.4)
  244. game:GetService("Chat"):Chat(char.Head, "If you would simply let yourself die, you would not have to go through this pointless suffering.", Enum.ChatColor.Red)
  245. wait(3.5)
  246. game:GetService("Chat"):Chat(char.Head, "All you have done is waste my time.", Enum.ChatColor.Red)
  247. wait(.1)
  248. c:Play()
  249. char.Humanoid.MaxHealth = math.huge
  250. wait(160)
  251. char.Humanoid.MaxHealth = 10000
  252. c:Remove()
  253.  
  254. -- Break earth
  255. elseif key == "b" and state then
  256. game:GetService("Chat"):Char(char.Head, "Hmph.", Enum.ChatColor.Red)
  257. wait(.01)
  258. for part in pairs(frames) do
  259. if part.Size == Vector3.new(4, 4, 4) then
  260. for x = -1, 2, 2 do
  261. for y = -1, 2, 2 do
  262. for z = -1, 1, 2 do
  263. local oPart = createEarth(workspace)
  264. oPart.Size = Vector3.new(2, 2, 2)
  265. oPart.CFrame = part.CFrame * CFrame.new(x*1.1, y*1.1, z*1.1)
  266. end
  267. end
  268. end
  269. part:Destroy()
  270. end
  271.  
  272. end
  273.  
  274. for part in pairs(frames) do
  275. if part.Size == Vector3.new(25, 15, 25) then
  276. for x = -3, 2, 2 do
  277. for y = -3, 2, 2 do
  278. for z = -3, 1, 2 do
  279. local oPart = createEarth(workspace)
  280. oPart.Size = Vector3.new(2, 2, 2)
  281. oPart.CFrame = part.CFrame * CFrame.new(x*1.1, y*1.1, z*1.1)
  282. end
  283. end
  284. end
  285. part:Destroy()
  286. end
  287.  
  288. end
  289.  
  290. for part in pairs(frames) do
  291. if part.Size == Vector3.new(2, 2, 2) then
  292. for x = -0.5, 2, 2 do
  293. for y = -0.5, 2, 2 do
  294. for z = -0.5, 1, 2 do
  295. local oPart = createEarth(workspace)
  296. oPart.Size = Vector3.new(1, 1, 1)
  297. oPart.CFrame = part.CFrame * CFrame.new(x*1.1, y*1.1, z*1.1)
  298. end
  299. end
  300. end
  301. part:Destroy()
  302. end
  303.  
  304. end
  305.  
  306.  
  307.  
  308.  
  309. -- Raise tower
  310. elseif key == "r" and state and not raisingTower then
  311. game:GetService("Chat"):Chat(char.Head, raisechats[math.random(1,#raisechats)], Enum.ChatColor.Red)
  312. raisingTower = true
  313. lastTower = nil
  314. if torso.Position.y - 5/2 < 20.4 then
  315. local part = createEarth(workspace)
  316. part.Anchored = true
  317. disabled[part] = true
  318.  
  319. for i = 0, 20, 4 do
  320. part.Size = Vector3.new(5, i, 5)
  321. part.CFrame = CFrame.new(torso.Position.x, 0.4 + part.Size.y/2, torso.Position.z)
  322. torso.CFrame = (torso.CFrame - torso.CFrame.p) + Vector3.new(torso.Position.x, part.Position.y + part.Size.y/2 + 5/2, torso.Position.z)
  323. wait(1/30)
  324. end
  325.  
  326. lastTower = part
  327.  
  328. disabled[part] = nil
  329. part.Anchored = false
  330. end
  331. raisingTower = false
  332.  
  333.  
  334. -- Raise wall
  335. elseif key == "t" and state and not wall then
  336. game:GetService("Chat"):Chat(char.Head, raisechats[math.random(1,#raisechats)], Enum.ChatColor.Red)
  337. wall = true
  338. lastWall = nil
  339. if torso.Position.y - 5/2 < 20.4 then
  340. local part = createEarth(workspace)
  341. part.Anchored = true
  342. disabled[part] = true
  343.  
  344. for i = 0, 1, 20 do
  345. part.Size = Vector3.new(25, 15, 25)
  346. part.CFrame = CFrame.new(torso.Position.x, 0.4 + part.Size.y/2, torso.Position.z)
  347. torso.CFrame = (torso.CFrame - torso.CFrame.p) + Vector3.new(torso.Position.x, part.Position.y + part.Size.y/2 + 5/2, torso.Position.z)
  348. wait(1/30)
  349. end
  350.  
  351. lastWall = part
  352.  
  353. disabled[part] = nil
  354. part.Anchored = false
  355. end
  356. wall = false
  357.  
  358. -- Ground attack
  359. elseif key == "g" and state and not groundAttack then
  360. game:GetService("Chat"):Chat(char.Head, Taunts[math.random(1,#Taunts)], Enum.ChatColor.Red)
  361. groundAttack = true
  362. delay(1, function()
  363. groundAttack = false
  364. end)
  365.  
  366. local dir = planeY(mouse.Hit.p - torso.Position).unit
  367. local pos = planeY(torso.Position, 0.4 + 1) + dir*5
  368.  
  369. local ground = {}
  370.  
  371. delay(5, function()
  372. for i = 1, 20 do
  373. for _, part in pairs(ground) do
  374. if part.Anchored then
  375. part.CFrame = part.CFrame + Vector3.new(0, -1/7, 0)
  376. end
  377. end
  378. wait(1/30)
  379. end
  380. for _, part in pairs(ground) do
  381. if part.Anchored then
  382. part:Destroy()
  383. end
  384. end
  385. end)
  386.  
  387. for i = 1, 10 do
  388. local hit, pos2 = rayCast(pos, dir*5, {char})
  389.  
  390. local part = createEarth(workspace)
  391. part.Anchored = true
  392. part.Size = Vector3.new(4, 4, 4)
  393. part.CFrame = CFrame.new(pos2, pos2 + dir) * CFrame.Angles(math.rad(-50), 0, 0) + Vector3.new(0, -0, 0)
  394.  
  395. ground[#ground + 1] = part
  396.  
  397. -- Add force
  398. if hit then
  399. local mass = hit:GetMass()
  400.  
  401. -- Hit player
  402. for _, oPlayer in pairs(game.Players:GetPlayers()) do
  403. if oPlayer.Character and oPlayer.Character:FindFirstChild("Torso") and hit:IsDescendantOf(oPlayer.Character) then
  404. hit = oPlayer.Character.Torso
  405. mass = 20
  406. end
  407. end
  408.  
  409. if hit.Name ~= "Torso" then
  410. hit:ClearAllChildren()
  411. end
  412. hit.Anchored = false
  413.  
  414. -- Add force
  415. local bodyForce = createBody("Force", hit)
  416. bodyForce.force = (dir + Vector3.new(0, 0.2, 0)).unit*1e4 * mass
  417.  
  418. game.Debris:AddItem(bodyForce, 1/30)
  419. break
  420. end
  421.  
  422. pos = pos2
  423. wait(1/20)
  424. end
  425. end
  426. end
  427.  
  428. --- CORE CODE BELOW --- CORE CODE BELOW --- CORE CODE BELOW ---
  429. --- CORE CODE BELOW --- CORE CODE BELOW --- CORE CODE BELOW ---
  430. --- CORE CODE BELOW --- CORE CODE BELOW --- CORE CODE BELOW ---
  431.  
  432. -- Clear old tool
  433. player.Backpack:ClearAllChildren()
  434.  
  435. -- Create tool
  436. local tool = Instance.new("HopperBin")
  437. tool.Parent = player.Backpack
  438. tool.Name = "Kronola's Custom"
  439.  
  440. -- Tool selected
  441. tool.Selected:connect(function(mouse)
  442. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  443.  
  444. -- Mouse events
  445. mouse.Button1Down:connect(function()
  446. mouseDown = true
  447. end)
  448. mouse.Button1Up:connect(function()
  449. mouseDown = false
  450. end)
  451. mouse.KeyDown:connect(function(key)
  452. keysDown[key:lower()] = true
  453. onKeyChange(mouse, key:lower(), true)
  454. end)
  455. mouse.KeyUp:connect(function(key)
  456. keysDown[key:lower()] = false
  457. onKeyChange(mouse, key:lower(), false)
  458. end)
  459.  
  460. -- Call main
  461. main(mouse)
  462. end)
  463.  
  464. --- LIBRARY BELOW --- LIBRARY BELOW --- LIBRARY BELOW ---
  465. --- LIBRARY BELOW --- LIBRARY BELOW --- LIBRARY BELOW ---
  466. --- LIBRARY BELOW --- LIBRARY BELOW --- LIBRARY BELOW ---
  467.  
  468. -- Ray cast
  469. function rayCast(pos, dir, ignore)
  470. return workspace:FindPartOnRayWithIgnoreList(Ray.new(pos, dir), ignore)
  471. end
  472.  
  473. -- Create body
  474. function createBody(type, path)
  475. local body = Instance.new("Body" .. type)
  476. if type == "Gyro" then
  477. body.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  478. elseif type ~= "Force" then
  479. body.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  480. end
  481. body.Parent = path
  482. return body
  483. end
  484.  
  485. -- Get parts in region 3
  486. function getPartsInRegion3(region, parts)
  487. repeat
  488. local regParts = workspace:FindPartsInRegion3WithIgnoreList(region, parts, 100)
  489. for i, part in pairs(regParts) do
  490. parts[#parts + 1] = part
  491. end
  492. until #regParts < 100
  493. end
  494.  
  495. -- Random
  496. function r(min, max)
  497. return math.random()*(max - min) + min
  498. end
  499.  
  500. -- Plane y
  501. function planeY(v, y)
  502. return Vector3.new(v.x, y or 0, v.z)
  503. end
  504.  
  505. -- Create earth
  506. function createEarth(path)
  507. local part = createPart("Earth", path)
  508. part.BrickColor = BrickColor.new("Really black")
  509. part.Material = "Slate"
  510. m = Instance.new("Fire",part)
  511. m.Heat = 10
  512. part.Parent = path
  513. return part
  514. end
  515.  
  516. -- Create part
  517. function createPart(name, path)
  518. local part = Instance.new("Part")
  519. part.FormFactor = "Symmetric"
  520. part.BottomSurface = "Smooth"
  521. part.TopSurface = "Smooth"
  522. part.Size = Vector3.new(1, 1, 1)
  523. part.Name = name
  524. part.Parent = path
  525. return part
  526. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement