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