SHOW:
|
|
- or go back to the newest paste.
1 | --Name Needed-- | |
2 | ||
3 | - | me = game.Players.jericoalejo |
3 | + | me = game.Players.dedsecbrazil |
4 | char = me.Character | |
5 | cube = nil | |
6 | size = 1 | |
7 | full = 2 | |
8 | upper = 13 | |
9 | name = "Soul cube" | |
10 | parts = {} | |
11 | hold = false | |
12 | deb = true | |
13 | loldist = 10 | |
14 | modes = {"bomb", "attack"} | |
15 | where = 1 | |
16 | mode = modes[where] | |
17 | ||
18 | function getavg(m) | |
19 | local x = {} | |
20 | local y = {} | |
21 | local z = {} | |
22 | for _,v in pairs(m:children()) do | |
23 | if v:IsA("BasePart") then | |
24 | table.insert(x,v.Position.X) | |
25 | table.insert(y,v.Position.Y) | |
26 | table.insert(z,v.Position.Z) | |
27 | end | |
28 | end | |
29 | local x2 = 0 | |
30 | local y2 = 0 | |
31 | local z2 = 0 | |
32 | for _,v in pairs(x) do | |
33 | x2 = x2 + v | |
34 | end | |
35 | for _,v in pairs(y) do | |
36 | y2 = y2 + v | |
37 | end | |
38 | for _,v in pairs(z) do | |
39 | z2 = z2 + v | |
40 | end | |
41 | local finalx = x2 / #x | |
42 | local finaly = y2 / #y | |
43 | local finalz = z2 / #z | |
44 | local vec = Vector3.new(finalx,finaly,finalz) | |
45 | return vec | |
46 | end | |
47 | ||
48 | function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form) | |
49 | part.Parent = parent | |
50 | part.formFactor = form | |
51 | part.CanCollide = collide | |
52 | part.Transparency = tran | |
53 | part.Reflectance = ref | |
54 | part.Size = Vector3.new(x,y,z) | |
55 | part.BrickColor = BrickColor.new(color) | |
56 | part.TopSurface = 0 | |
57 | part.BottomSurface = 0 | |
58 | part.Anchored = anchor | |
59 | part.Locked = true | |
60 | Instance.new("BlockMesh",part) | |
61 | part:BreakJoints() | |
62 | end | |
63 | ||
64 | function getnoobs(pos) | |
65 | local hums = {} | |
66 | for _,v in pairs(workspace:children()) do | |
67 | for _,k in pairs(v:children()) do | |
68 | local to = v:findFirstChild("Torso") | |
69 | if k:IsA("Humanoid") and to ~= nil then | |
70 | if (to.Position - pos).magnitude < loldist then | |
71 | table.insert(hums,k) | |
72 | end | |
73 | end | |
74 | end | |
75 | end | |
76 | return hums | |
77 | end | |
78 | ||
79 | function makecube(pos) | |
80 | parts = {} | |
81 | for _,v in pairs(workspace:children()) do | |
82 | if v.Name == name then | |
83 | v:remove() | |
84 | end | |
85 | end | |
86 | local mo = Instance.new("Model",workspace) | |
87 | mo.Name = name | |
88 | cube = mo | |
89 | local x, y, z = -full, -full, -full | |
90 | local center = CFrame.new(pos) * CFrame.new(0,upper,0) | |
91 | repeat | |
92 | local cu = Instance.new("Part") | |
93 | prop(cu,mo,false,0,0,size,size,size,"Really black",true,"Custom") | |
94 | cu.CFrame = center * CFrame.new(x,y,z) | |
95 | table.insert(parts,cu) | |
96 | x = x + size | |
97 | if x > full then | |
98 | x = -full | |
99 | y = y + size | |
100 | end | |
101 | if y > full then | |
102 | y = -full | |
103 | z = z + size | |
104 | end | |
105 | until z > full | |
106 | local lo = full+(size*0.1) | |
107 | for o=1,360, 90 do | |
108 | local p = Instance.new("Part") | |
109 | prop(p,mo,false,0,0.15,size,size,size,"Really black",true,"Custom") | |
110 | p.CFrame = center * CFrame.Angles(0,math.rad(o),0) * CFrame.new(lo,lo,lo) | |
111 | table.insert(parts,p) | |
112 | end | |
113 | for o=1,360, 90 do | |
114 | local p = Instance.new("Part") | |
115 | prop(p,mo,false,0,0.15,size,size,size,"Really black",true,"Custom") | |
116 | p.CFrame = center * CFrame.Angles(0,math.rad(o),0) * CFrame.new(lo,-lo,lo) | |
117 | table.insert(parts,p) | |
118 | end | |
119 | for o=1,360, 90 do | |
120 | local p = Instance.new("Part") | |
121 | prop(p,mo,false,0,0.15,size*1.5,size*1.5,size*1.5,"Really black",true,"Custom") | |
122 | p.CFrame = center * CFrame.Angles(0,math.rad(o),0) * CFrame.new(0,0,lo) | |
123 | table.insert(parts,p) | |
124 | end | |
125 | for o=-full,full,full*2 do | |
126 | local p = Instance.new("Part") | |
127 | prop(p,mo,false,0,0.15,size*1.5,size*1.5,size*1.5,"Really black",true,"Custom") | |
128 | p.CFrame = center * CFrame.Angles(0,0,0) * CFrame.new(0,o,0) | |
129 | table.insert(parts,p) | |
130 | end | |
131 | end | |
132 | ||
133 | makecube(me.Character.Torso.Position) | |
134 | ||
135 | function move(way) | |
136 | coroutine.resume(coroutine.create(function() | |
137 | for i,v in pairs(parts) do | |
138 | wait() | |
139 | if way == "fr" then | |
140 | v.CFrame = CFrame.new(v.Position) * CFrame.new(0,0,-3) | |
141 | elseif way == "ba" then | |
142 | v.CFrame = CFrame.new(v.Position) * CFrame.new(0,0,3) | |
143 | elseif way == "le" then | |
144 | v.CFrame = CFrame.new(v.Position) * CFrame.new(-3,0,0) | |
145 | elseif way == "ri" then | |
146 | v.CFrame = CFrame.new(v.Position) * CFrame.new(3,0,0) | |
147 | elseif way == "up" then | |
148 | v.CFrame = CFrame.new(v.Position) * CFrame.new(0,3,0) | |
149 | elseif way == "do" then | |
150 | v.CFrame = CFrame.new(v.Position) * CFrame.new(0,-3,0) | |
151 | end | |
152 | end | |
153 | end)) | |
154 | end | |
155 | ||
156 | if script.Parent.className ~= "HopperBin" then | |
157 | h = Instance.new("HopperBin",me.Backpack) | |
158 | h.Name = "SoulCube" | |
159 | script.Parent = h | |
160 | end | |
161 | bin = script.Parent | |
162 | function sel(mouse) | |
163 | mouse.KeyDown:connect(function(key) | |
164 | key = key:lower() | |
165 | if key == "t" then | |
166 | hold = true | |
167 | while hold do | |
168 | move("fr") | |
169 | wait(0.1) | |
170 | end | |
171 | elseif key == "g" then | |
172 | hold = true | |
173 | while hold do | |
174 | move("ba") | |
175 | wait(0.1) | |
176 | end | |
177 | elseif key == "f" then | |
178 | hold = true | |
179 | while hold do | |
180 | move("le") | |
181 | wait(0.1) | |
182 | end | |
183 | elseif key == "h" then | |
184 | hold = true | |
185 | while hold do | |
186 | move("ri") | |
187 | wait(0.1) | |
188 | end | |
189 | elseif key == "u" then | |
190 | hold = true | |
191 | while hold do | |
192 | move("up") | |
193 | wait(0.1) | |
194 | end | |
195 | elseif key == "j" then | |
196 | hold = true | |
197 | while hold do | |
198 | move("do") | |
199 | wait(0.1) | |
200 | end | |
201 | elseif key == "q" then | |
202 | where = where - 1 | |
203 | if where < 1 then | |
204 | where = #modes | |
205 | end | |
206 | mode = modes[where] | |
207 | elseif key == "e" then | |
208 | where = where + 1 | |
209 | if where > #modes then | |
210 | where = 1 | |
211 | end | |
212 | mode = modes[where] | |
213 | elseif key == string.char(9) then | |
214 | makecube(me.Character.Torso.Position) | |
215 | end | |
216 | end) | |
217 | mouse.KeyUp:connect(function(key) | |
218 | key = key:lower() | |
219 | if key == "t" or key == "g" or key == "f" or key == "h" or key == "u" or key == "j" then | |
220 | hold = false | |
221 | end | |
222 | end) | |
223 | mouse.Button1Down:connect(function() | |
224 | if deb then | |
225 | if mode == "attack" then | |
226 | deb = false | |
227 | local poz = mouse.Hit.p | |
228 | lol = false | |
229 | for _,v in pairs(cube:children()) do | |
230 | local lastpos = v.CFrame | |
231 | v.Anchored = false | |
232 | v.Velocity = Vector3.new(math.random(-40,40),math.random(-40,40),0) | |
233 | coroutine.resume(coroutine.create(function() | |
234 | local b = Instance.new("BodyPosition",v) | |
235 | b.P = 12000 | |
236 | b.maxForce = Vector3.new(math.huge,math.huge,math.huge) | |
237 | b.position = poz + Vector3.new(math.random(-10,10)/10,math.random(-10,10)/10,math.random(-10,10)/10) | |
238 | wait(2.2) | |
239 | local cf = CFrame.new(poz,b.position) * CFrame.new(0,0,math.random(120,135)/10).p | |
240 | b.position = cf | |
241 | lol = true | |
242 | wait(1.8) | |
243 | b.position = lastpos.p | |
244 | repeat wait() until (v.Position - b.position).magnitude < 3 | |
245 | b:remove() | |
246 | v.Anchored = true | |
247 | for i=1,2 do | |
248 | v.CFrame = lastpos | |
249 | wait() | |
250 | end | |
251 | end)) | |
252 | end | |
253 | repeat wait() until lol == true | |
254 | local pwn = Instance.new("Part") | |
255 | prop(pwn,cube,false,1,0,1,1,1,"Black",true,"Brick") | |
256 | pwn.CFrame = CFrame.new(poz) | |
257 | local fi = Instance.new("Fire",pwn) | |
258 | fi.Size = 1 | |
259 | fi.Heat = 0 | |
260 | fi.Color = Color3.new(1,0.3,0) | |
261 | fi.SecondaryColor = fi.Color | |
262 | for i=1,40,1 do | |
263 | wait() | |
264 | fi.Size = i | |
265 | end | |
266 | local hus = getnoobs(pwn.Position) | |
267 | for _,v in pairs(hus) do | |
268 | coroutine.resume(coroutine.create(function() | |
269 | for i=1, 15 do | |
270 | v.Health = v.Health - 4 | |
271 | wait() | |
272 | end | |
273 | end)) | |
274 | end | |
275 | for i=40,1,-2 do | |
276 | wait() | |
277 | fi.Size = i | |
278 | end | |
279 | pwn:remove() | |
280 | wait(2.4) | |
281 | deb = true | |
282 | elseif mode == "bomb" then | |
283 | deb = false | |
284 | local avrg = getavg(cube) | |
285 | for _,v in pairs(cube:children()) do | |
286 | local lastpos = v.CFrame | |
287 | v.Anchored = false | |
288 | coroutine.resume(coroutine.create(function() | |
289 | local b = Instance.new("BodyPosition",v) | |
290 | b.P = 15000 | |
291 | b.maxForce = Vector3.new(math.huge,math.huge,math.huge) | |
292 | b.position = CFrame.new(v.Position, avrg) * CFrame.new(0,0,7).p | |
293 | wait(4) | |
294 | b.Parent = nil | |
295 | b.position = lastpos.p | |
296 | local hih = CFrame.new(v.Position, avrg) | |
297 | v.Velocity = hih.lookVector * 110 | |
298 | wait(1.8) | |
299 | b.Parent = v | |
300 | repeat wait() until (v.Position - lastpos.p).magnitude < 4 | |
301 | v.Anchored = true | |
302 | b:remove() | |
303 | v.CFrame = lastpos | |
304 | end)) | |
305 | end | |
306 | local pwn = Instance.new("Part") | |
307 | prop(pwn,cube,false,1,0,1,1,1,"Black",true,"Brick") | |
308 | pwn.CFrame = CFrame.new(avrg) | |
309 | local fi = Instance.new("Fire",pwn) | |
310 | fi.Size = 1 | |
311 | fi.Heat = 0 | |
312 | fi.Color = Color3.new(1,0.2,0) | |
313 | fi.SecondaryColor = fi.Color | |
314 | for i=1,22,0.5 do | |
315 | wait() | |
316 | fi.Size = i | |
317 | end | |
318 | wait(2.4) | |
319 | pwn:remove() | |
320 | wait(1) | |
321 | loldist = 17 | |
322 | local hus = getnoobs(pwn.Position) | |
323 | for _,v in pairs(hus) do | |
324 | v.Health = v.Health - math.random(90,110) | |
325 | end | |
326 | loldist = 10 | |
327 | wait(1) | |
328 | deb = true | |
329 | end | |
330 | end | |
331 | end) | |
332 | end | |
333 | bin.Selected:connect(sel) |