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