View difference between Paste ID: ghhkk6yu and EKWDyPSG
SHOW: | | - or go back to the newest paste.
1
-- Player declarations
2-
local player = game.Players.Filipek8792
2+
local player = game.Players.ilovemen536
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 = {"Foolish.", "Take that!", "Heh.", "You have no hope.", "Grow up.", "DIE!", "EARTH, SHOOT!", "GOOD LUCK STAYING ALIVE!", "You pitiful being."}
22
local raisechats = {"Earth, raise!", "Get Ready to DIE!", "Heheh..", "Time to die.","Fool.", "Worthless.","Muhahah.","Good Luck, You'll Need it.","TROLLFAIC"}
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
-- Break earth
187
elseif key == "b" and state then
188
game:GetService("Chat"):Chat(char.Head, "Earth, BREAK!", Enum.ChatColor.Red)
189
for part in pairs(frames) do
190
if part.Size == Vector3.new(4, 4, 4) then
191
for x = -1, 2, 2 do
192
for y = -1, 2, 2 do
193
for z = -1, 1, 2 do
194
local oPart = createEarth(workspace)
195
oPart.Size = Vector3.new(2, 2, 2)
196
oPart.CFrame = part.CFrame * CFrame.new(x*1.1, y*1.1, z*1.1)
197
end
198
end
199
end
200
part:Destroy()
201
end
202
 
203
end
204
 
205
for part in pairs(frames) do
206
if part.Size == Vector3.new(25, 15, 25) then
207
for x = -3, 2, 2 do
208
for y = -3, 2, 2 do
209
for z = -3, 1, 2 do
210
local oPart = createEarth(workspace)
211
oPart.Size = Vector3.new(2, 2, 2)
212
oPart.CFrame = part.CFrame * CFrame.new(x*1.1, y*1.1, z*1.1)
213
end
214
end
215
end
216
part:Destroy()
217
end
218
 
219
end
220
 
221
for part in pairs(frames) do
222
if part.Size == Vector3.new(2, 2, 2) then
223
for x = -0.5, 2, 2 do
224
for y = -0.5, 2, 2 do
225
for z = -0.5, 1, 2 do
226
local oPart = createEarth(workspace)
227
oPart.Size = Vector3.new(1, 1, 1)
228
oPart.CFrame = part.CFrame * CFrame.new(x*1.1, y*1.1, z*1.1)
229
end
230
end
231
end
232
part:Destroy()
233
end
234
 
235
end
236
 
237
 
238
 
239
 
240
-- Raise tower
241
elseif key == "r" and state and not raisingTower then
242
game:GetService("Chat"):Chat(char.Head, raisechats[math.random(1,#raisechats)], Enum.ChatColor.Red)
243
raisingTower = true
244
lastTower = nil
245
if torso.Position.y - 5/2 < 20.4 then
246
local part = createEarth(workspace)
247
part.Anchored = true
248
disabled[part] = true
249
 
250
for i = 0, 20, 4 do
251
part.Size = Vector3.new(5, i, 5)
252
part.CFrame = CFrame.new(torso.Position.x, 0.4 + part.Size.y/2, torso.Position.z)
253
torso.CFrame = (torso.CFrame - torso.CFrame.p) + Vector3.new(torso.Position.x, part.Position.y + part.Size.y/2 + 5/2, torso.Position.z)
254
wait(1/30)
255
end
256
 
257
lastTower = part
258
 
259
disabled[part] = nil
260
part.Anchored = false
261
end
262
raisingTower = false
263
 
264
 
265
-- Raise wall
266
elseif key == "t" and state and not wall then
267
game:GetService("Chat"):Chat(char.Head, raisechats[math.random(1,#raisechats)], Enum.ChatColor.Red)
268
wall = true
269
lastWall = nil
270
if torso.Position.y - 5/2 < 20.4 then
271
local part = createEarth(workspace)
272
part.Anchored = true
273
disabled[part] = true
274
 
275
for i = 0, 1, 20 do
276
part.Size = Vector3.new(25, 15, 25)
277
part.CFrame = CFrame.new(torso.Position.x, 0.4 + part.Size.y/2, torso.Position.z)
278
torso.CFrame = (torso.CFrame - torso.CFrame.p) + Vector3.new(torso.Position.x, part.Position.y + part.Size.y/2 + 5/2, torso.Position.z)
279
wait(1/30)
280
end
281
 
282
lastWall = part
283
 
284
disabled[part] = nil
285
part.Anchored = false
286
end
287
wall = false
288
 
289
-- Ground attack
290
elseif key == "g" and state and not groundAttack then
291
game:GetService("Chat"):Chat(char.Head, Taunts[math.random(1,#Taunts)], Enum.ChatColor.Red)
292
groundAttack = true
293
delay(1, function()
294
groundAttack = false
295
end)
296
 
297
local dir = planeY(mouse.Hit.p - torso.Position).unit
298
local pos = planeY(torso.Position, 0.4 + 1) + dir*5
299
 
300
local ground = {}
301
 
302
delay(5, function()
303
for i = 1, 20 do
304
for _, part in pairs(ground) do
305
if part.Anchored then
306
part.CFrame = part.CFrame + Vector3.new(0, -1/7, 0)
307
end
308
end
309
wait(1/30)
310
end
311
for _, part in pairs(ground) do
312
if part.Anchored then
313
part:Destroy()
314
end
315
end
316
end)
317
 
318
for i = 1, 10 do
319
local hit, pos2 = rayCast(pos, dir*5, {char})
320
 
321
local part = createEarth(workspace)
322
part.Anchored = true
323
part.Size = Vector3.new(4, 4, 4)
324
part.CFrame = CFrame.new(pos2, pos2 + dir) * CFrame.Angles(math.rad(-50), 0, 0) + Vector3.new(0, -0, 0)
325
 
326
ground[#ground + 1] = part
327
 
328
-- Add force
329
if hit then
330
local mass = hit:GetMass()
331
 
332
-- Hit player
333
for _, oPlayer in pairs(game.Players:GetPlayers()) do
334
if oPlayer.Character and oPlayer.Character:FindFirstChild("Torso") and hit:IsDescendantOf(oPlayer.Character) then
335
hit = oPlayer.Character.Torso
336
mass = 20
337
end
338
end
339
 
340
if hit.Name ~= "Torso" then
341
hit:ClearAllChildren()
342
end
343
hit.Anchored = false
344
 
345
-- Add force
346
local bodyForce = createBody("Force", hit)
347
bodyForce.force = (dir + Vector3.new(0, 0.2, 0)).unit*1e4 * mass
348
 
349
game.Debris:AddItem(bodyForce, 1/30)
350
break
351
end
352
 
353
pos = pos2
354
wait(1/20)
355
end
356
end
357
end
358
 
359
--- CORE CODE BELOW --- CORE CODE BELOW --- CORE CODE BELOW ---
360
--- CORE CODE BELOW --- CORE CODE BELOW --- CORE CODE BELOW ---
361
--- CORE CODE BELOW --- CORE CODE BELOW --- CORE CODE BELOW ---
362
 
363
-- Clear old tool
364
player.Backpack:ClearAllChildren()
365
 
366
-- Create tool
367
local tool = Instance.new("HopperBin")
368
tool.Parent = player.Backpack
369
tool.Name = "Dark Bending"
370
 
371
-- Tool selected
372
tool.Selected:connect(function(mouse)
373
mouse.Icon = "rbxasset://textures\\GunCursor.png"
374
 
375
-- Mouse events
376
mouse.Button1Down:connect(function()
377
mouseDown = true
378
end)
379
mouse.Button1Up:connect(function()
380
mouseDown = false
381
end)
382
mouse.KeyDown:connect(function(key)
383
keysDown[key:lower()] = true
384
onKeyChange(mouse, key:lower(), true)
385
end)
386
mouse.KeyUp:connect(function(key)
387
keysDown[key:lower()] = false
388
onKeyChange(mouse, key:lower(), false)
389
end)
390
 
391
-- Call main
392
main(mouse)
393
end)
394
 
395
--- LIBRARY BELOW --- LIBRARY BELOW --- LIBRARY BELOW ---
396
--- LIBRARY BELOW --- LIBRARY BELOW --- LIBRARY BELOW ---
397
--- LIBRARY BELOW --- LIBRARY BELOW --- LIBRARY BELOW ---
398
 
399
-- Ray cast
400
function rayCast(pos, dir, ignore)
401
return workspace:FindPartOnRayWithIgnoreList(Ray.new(pos, dir), ignore)
402
end
403
 
404
-- Create body
405
function createBody(type, path)
406
local body = Instance.new("Body" .. type)
407
if type == "Gyro" then
408
body.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
409
elseif type ~= "Force" then
410
body.maxForce = Vector3.new(math.huge, math.huge, math.huge)
411
end
412
body.Parent = path
413
return body
414
end
415
 
416
-- Get parts in region 3
417
function getPartsInRegion3(region, parts)
418
repeat
419
local regParts = workspace:FindPartsInRegion3WithIgnoreList(region, parts, 100)
420
for i, part in pairs(regParts) do
421
parts[#parts + 1] = part
422
end
423
until #regParts < 100
424
end
425
 
426
-- Random
427
function r(min, max)
428
return math.random()*(max - min) + min
429
end
430
 
431
-- Plane y
432
function planeY(v, y)
433
return Vector3.new(v.x, y or 0, v.z)
434
end
435
 
436
-- Create earth
437
function createEarth(path)
438
local part = createPart("Earth", path)
439
part.BrickColor = BrickColor.new("Really black")
440
part.Material = "Slate"
441
m = Instance.new("Fire",part)
442
m.Heat = 10
443
part.Parent = path
444
return part
445
end
446
 
447
-- Create part
448
function createPart(name, path)
449
local part = Instance.new("Part")
450
part.FormFactor = "Symmetric"
451
part.BottomSurface = "Smooth"
452
part.TopSurface = "Smooth"
453
part.Size = Vector3.new(1, 1, 1)
454
part.Name = name
455
part.Parent = path
456
return part
457
end