SHOW:
|
|
- or go back to the newest paste.
1 | local isScriptNil = false | |
2 | ||
3 | - | local PlrName = "Chillarz" |
3 | + | local PlrName = "zombieslayerwtf" |
4 | local Plrs = game:GetService("Players") | |
5 | local RunService = game:GetService("RunService") | |
6 | local Content = game:GetService("ContentProvider") | |
7 | local LP = Plrs.LocalPlayer | |
8 | local Char = LP.Character | |
9 | local PlrGui = LP.PlayerGui | |
10 | local Backpack = LP.Backpack | |
11 | local Mouse = LP:GetMouse() | |
12 | ||
13 | local Camera = Workspace.CurrentCamera | |
14 | local LastCamCF = Camera.CoordinateFrame | |
15 | local AnimJoints = {} | |
16 | local Cons = {} | |
17 | local mDown = false | |
18 | local Multi = false | |
19 | local Grabbing = false | |
20 | local Current = {} | |
21 | local Alpha = 1 | |
22 | local LightNum = 1 | |
23 | ||
24 | Current.Part = nil | |
25 | Current.BP = nil | |
26 | Current.BA = nil | |
27 | Current.Mass = nil | |
28 | ||
29 | local LastPart = nil | |
30 | ||
31 | local Head = Char["Head"] | |
32 | local Torso = Char["Torso"] | |
33 | local Humanoid = Char["Humanoid"] | |
34 | local LA = Char["Left Arm"] | |
35 | local RA = Char["Right Arm"] | |
36 | local LL = Char["Left Leg"] | |
37 | local RL = Char["Right Leg"] | |
38 | ||
39 | local LS, RS; | |
40 | ||
41 | local OrigLS = Torso["Left Shoulder"] | |
42 | local OrigRS = Torso["Right Shoulder"] | |
43 | ||
44 | for _,v in pairs(Char:GetChildren()) do | |
45 | if v.Name == ModID then | |
46 | v:Destroy() | |
47 | end | |
48 | end | |
49 | ||
50 | for _,v in pairs(PlrGui:GetChildren()) do | |
51 | if v.Name == "PadsGui" then | |
52 | v:Destroy() | |
53 | end | |
54 | end | |
55 | ||
56 | local ModID = "Pads" | |
57 | local Objects = {} | |
58 | local Grav = 196.2 | |
59 | ||
60 | local sin=math.sin | |
61 | local cos=math.cos | |
62 | local max=math.max | |
63 | local min=math.min | |
64 | local atan2=math.atan2 | |
65 | local random=math.random | |
66 | local tau = 2 * math.pi | |
67 | ||
68 | local BodyObjects = { | |
69 | ["BodyVelocity"] = true; | |
70 | ["BodyAngularVelocity"] = true; | |
71 | ["BodyForce"] = true; | |
72 | ["BodyThrust"] = true; | |
73 | ["BodyPosition"] = true; | |
74 | ["RocketPropulsion"] = true; | |
75 | } | |
76 | ||
77 | if LP.Name == PlrName and isScriptNil then | |
78 | script.Parent = nil | |
79 | end | |
80 | ||
81 | LP.CameraMode = "Classic" | |
82 | ||
83 | local Assets = { | |
84 | } | |
85 | ||
86 | local LS0, LS1 = OrigLS.C0, OrigLS.C1 | |
87 | local RS0, RS1 = OrigRS.C0, OrigRS.C1 | |
88 | ||
89 | for i,v in pairs(Assets) do | |
90 | local ID = tostring(Assets[i]) | |
91 | Assets[i] = "http://www.roblox.com/asset/?id=" .. ID | |
92 | Content:Preload("http://www.roblox.com/asset/?id=" .. ID) | |
93 | end | |
94 | ||
95 | function QuaternionFromCFrame(cf) | |
96 | local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components(); | |
97 | local trace = m00 + m11 + m22 if trace > 0 then | |
98 | local s = math.sqrt(1 + trace); | |
99 | local recip = 0.5/s; | |
100 | return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5; | |
101 | else | |
102 | local i = 0; | |
103 | if m11 > m00 then | |
104 | i = 1; | |
105 | end; | |
106 | if m22 > (i == 0 and m00 or m11) then | |
107 | i = 2 end if i == 0 then | |
108 | local s = math.sqrt(m00-m11-m22+1); | |
109 | local recip = 0.5/s return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip; | |
110 | elseif i == 1 then | |
111 | local s = math.sqrt(m11-m22-m00+1); | |
112 | local recip = 0.5/s; | |
113 | return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip ; | |
114 | elseif i == 2 then | |
115 | local s = math.sqrt(m22-m00-m11+1); | |
116 | local recip = 0.5/s; | |
117 | return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip; | |
118 | end; | |
119 | end; | |
120 | end; | |
121 | ||
122 | function QuaternionToCFrame(px, py, pz, x, y, z, w) | |
123 | local xs, ys, zs = x + x, y + y, z + z; | |
124 | local wx, wy, wz = w*xs, w*ys, w*zs; | |
125 | local xx = x*xs; | |
126 | local xy = x*ys; | |
127 | local xz = x*zs; | |
128 | local yy = y*ys; | |
129 | local yz = y*zs; | |
130 | local zz = z*zs; | |
131 | return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy)) | |
132 | end; | |
133 | ||
134 | function QuaternionSlerp(a, b, t) | |
135 | local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]; | |
136 | local startInterp, finishInterp; | |
137 | if cosTheta >= 0.0001 then | |
138 | if (1 - cosTheta) > 0.0001 then | |
139 | local theta = math.acos(cosTheta); | |
140 | local invSinTheta = 1/math.sin(theta); | |
141 | startInterp = math.sin((1-t)*theta)*invSinTheta; | |
142 | finishInterp = math.sin(t*theta)*invSinTheta; | |
143 | else | |
144 | startInterp = 1-t finishInterp = t; | |
145 | end; | |
146 | else | |
147 | if (1+cosTheta) > 0.0001 then | |
148 | local theta = math.acos(-cosTheta); | |
149 | local invSinTheta = 1/math.sin(theta); | |
150 | startInterp = math.sin((t-1)*theta)*invSinTheta; | |
151 | finishInterp = math.sin(t*theta)*invSinTheta; | |
152 | else startInterp = t-1 finishInterp = t; | |
153 | end; | |
154 | end; | |
155 | return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp; | |
156 | end; | |
157 | ||
158 | function CLerp(a,b,t) | |
159 | local qa={QuaternionFromCFrame(a)}; | |
160 | local qb={QuaternionFromCFrame(b)}; | |
161 | local ax,ay,az=a.x,a.y,a.z; | |
162 | local bx,by,bz=b.x,b.y,b.z; | |
163 | local _t=1-t; | |
164 | return QuaternionToCFrame(_t*ax+t*bx,_t*ay+t*by,_t*az+t*bz,QuaternionSlerp(qa, qb, t)); | |
165 | end | |
166 | ||
167 | function GetWeld(weld) | |
168 | local obj | |
169 | for i, v in pairs(AnimJoints) do | |
170 | if v[1] == weld then | |
171 | obj = v | |
172 | break | |
173 | end | |
174 | end | |
175 | if not obj then | |
176 | obj = {weld,NV} | |
177 | table.insert(AnimJoints,obj) | |
178 | end | |
179 | return weld.C0.p, obj[2] | |
180 | end | |
181 | ||
182 | function SetWeld(weld, i, loops, origpos, origangle, nextpos, nextangle, override, overrideLower, smooth) | |
183 | smooth = smooth or 1 | |
184 | local obj | |
185 | for i, v in pairs(AnimJoints) do | |
186 | if v[1] == weld then | |
187 | obj = v | |
188 | break | |
189 | end | |
190 | end | |
191 | if not obj then | |
192 | obj = {weld,NV} | |
193 | table.insert(AnimJoints,obj) | |
194 | end | |
195 | ||
196 | local perc = (smooth == 1 and math.sin((math.pi/2)/loops*i)) or i/loops | |
197 | ||
198 | local tox,toy,toz = 0,0,0 | |
199 | tox = math.abs(origangle.x - nextangle.x) *perc | |
200 | toy = math.abs(origangle.y - nextangle.y) *perc | |
201 | toz = math.abs(origangle.z - nextangle.z) *perc | |
202 | tox = ((origangle.x > nextangle.x and -tox) or tox) | |
203 | toy = ((origangle.y > nextangle.y and -toy) or toy) | |
204 | toz = ((origangle.z > nextangle.z and -toz) or toz) | |
205 | ||
206 | local tox2,toy2,toz2 = 0,0,0 | |
207 | tox2 = math.abs(origpos.x - nextpos.x) *perc | |
208 | toy2 = math.abs(origpos.y - nextpos.y) *perc | |
209 | toz2 = math.abs(origpos.z - nextpos.z) *perc | |
210 | tox2 = (origpos.x > nextpos.x and -tox2) or tox2 | |
211 | toy2 = (origpos.y > nextpos.y and -toy2) or toy2 | |
212 | toz2 = (origpos.z > nextpos.z and -toz2) or toz2 | |
213 | ||
214 | obj[2] = Vector3.new(origangle.x + tox, origangle.y + toy, origangle.z + toz) | |
215 | weld.C0 = CFrame.new(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2) * CFrame.Angles(origangle.x + tox,origangle.y + toy,origangle.z + toz) | |
216 | end | |
217 | ||
218 | function RotateCamera(x, y) | |
219 | Camera.CoordinateFrame = CFrame.new(Camera.Focus.p) * (Camera.CoordinateFrame - Camera.CoordinateFrame.p) * CFrame.Angles(x, y, 0) * CFrame.new(0, 0, (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude) | |
220 | end | |
221 | ||
222 | function GetAngles(cf) | |
223 | local lv = cf.lookVector | |
224 | return -math.asin(lv.y), math.atan2(lv.x, -lv.z) | |
225 | end | |
226 | ||
227 | local LastCamCF = Camera.CoordinateFrame | |
228 | ||
229 | function Look() | |
230 | if AlphaOn == true then | |
231 | local x, y = GetAngles(LastCamCF:toObjectSpace(Camera.CoordinateFrame)) | |
232 | Camera.CoordinateFrame = LastCamCF | |
233 | RotateCamera(x * -(Alpha), y * -(Alpha)) | |
234 | LastCamCF = Camera.CoordinateFrame | |
235 | end | |
236 | end | |
237 | ||
238 | function Cor(Func) | |
239 | local Ok, Err = coroutine.resume(coroutine.create(Func)) | |
240 | if not Ok then | |
241 | print(Err) | |
242 | end | |
243 | end | |
244 | ||
245 | function Cor2(Func) | |
246 | local Ok, Err = ypcall(Func) | |
247 | if not Ok then | |
248 | print(Err) | |
249 | end | |
250 | end | |
251 | ||
252 | function MakePads() | |
253 | -- 1 - VTelekinesis | |
254 | P1 = Instance.new("Model") | |
255 | P1.Name = ModID | |
256 | ||
257 | -- 2 - RBase | |
258 | P2 = Instance.new("Part") | |
259 | P2.CFrame = CFrame.new(Vector3.new(21.100008, 1.95000589, 11.899971)) * CFrame.Angles(-0, 0, -0) | |
260 | P2.FormFactor = Enum.FormFactor.Custom | |
261 | P2.Size = Vector3.new(0.799999952, 0.200000003, 0.800000012) | |
262 | P2.Anchored = true | |
263 | P2.BrickColor = BrickColor.new("Crimson") | |
264 | P2.Friction = 0.30000001192093 | |
265 | P2.Shape = Enum.PartType.Block | |
266 | P2.Name = "RBase" | |
267 | P2.Parent = P1 | |
268 | ||
269 | -- 3 - Mesh | |
270 | P3 = Instance.new("CylinderMesh") | |
271 | P3.Scale = Vector3.new(1, 0.5, 1) | |
272 | P3.Parent = P2 | |
273 | ||
274 | -- 4 - LBase | |
275 | P4 = Instance.new("Part") | |
276 | P4.CFrame = CFrame.new(Vector3.new(18.100008, 1.95000589, 11.899971)) * CFrame.Angles(-0, 0, -0) | |
277 | P4.FormFactor = Enum.FormFactor.Custom | |
278 | P4.Size = Vector3.new(0.799999952, 0.200000003, 0.800000012) | |
279 | P4.Anchored = true | |
280 | P4.BrickColor = BrickColor.new("Crimson") | |
281 | P4.Friction = 0.30000001192093 | |
282 | P4.Shape = Enum.PartType.Block | |
283 | P4.Name = "LBase" | |
284 | P4.Parent = P1 | |
285 | ||
286 | -- 5 - Mesh | |
287 | P5 = Instance.new("CylinderMesh") | |
288 | P5.Scale = Vector3.new(1, 0.5, 1) | |
289 | P5.Parent = P4 | |
290 | ||
291 | -- 6 - RP1 | |
292 | P6 = Instance.new("Part") | |
293 | P6.CFrame = CFrame.new(Vector3.new(20.8999996, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
294 | P6.FormFactor = Enum.FormFactor.Custom | |
295 | P6.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
296 | P6.Anchored = true | |
297 | P6.BrickColor = BrickColor.new("Black") | |
298 | P6.Friction = 0.30000001192093 | |
299 | P6.Shape = Enum.PartType.Block | |
300 | P6.Name = "RP1" | |
301 | P6.Parent = P2 | |
302 | ||
303 | -- 7 - Mesh | |
304 | P7 = Instance.new("CylinderMesh") | |
305 | P7.Scale = Vector3.new(1, 0.5, 1) | |
306 | P7.Parent = P6 | |
307 | ||
308 | -- 8 - RP2 | |
309 | P8 = Instance.new("Part") | |
310 | P8.CFrame = CFrame.new(Vector3.new(21.1000004, 1.8499999, 11.6999998)) * CFrame.Angles(-0, 0, -0) | |
311 | P8.FormFactor = Enum.FormFactor.Custom | |
312 | P8.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
313 | P8.Anchored = true | |
314 | P8.BrickColor = BrickColor.new("Black") | |
315 | P8.Friction = 0.30000001192093 | |
316 | P8.Shape = Enum.PartType.Block | |
317 | P8.Name = "RP2" | |
318 | P8.Parent = P2 | |
319 | ||
320 | -- 9 - Mesh | |
321 | P9 = Instance.new("CylinderMesh") | |
322 | P9.Scale = Vector3.new(1, 0.5, 1) | |
323 | P9.Parent = P8 | |
324 | ||
325 | -- 10 - RP3 | |
326 | P10 = Instance.new("Part") | |
327 | P10.CFrame = CFrame.new(Vector3.new(21.3000011, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
328 | P10.FormFactor = Enum.FormFactor.Custom | |
329 | P10.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
330 | P10.Anchored = true | |
331 | P10.BrickColor = BrickColor.new("Black") | |
332 | P10.Friction = 0.30000001192093 | |
333 | P10.Shape = Enum.PartType.Block | |
334 | P10.Name = "RP3" | |
335 | P10.Parent = P2 | |
336 | ||
337 | -- 11 - Mesh | |
338 | P11 = Instance.new("CylinderMesh") | |
339 | P11.Scale = Vector3.new(1, 0.5, 1) | |
340 | P11.Parent = P10 | |
341 | ||
342 | -- 12 - LP1 | |
343 | P12 = Instance.new("Part") | |
344 | P12.CFrame = CFrame.new(Vector3.new(17.8999996, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
345 | P12.FormFactor = Enum.FormFactor.Custom | |
346 | P12.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
347 | P12.Anchored = true | |
348 | P12.BrickColor = BrickColor.new("Black") | |
349 | P12.Friction = 0.30000001192093 | |
350 | P12.Shape = Enum.PartType.Block | |
351 | P12.Name = "LP1" | |
352 | P12.Parent = P4 | |
353 | ||
354 | -- 13 - Mesh | |
355 | P13 = Instance.new("CylinderMesh") | |
356 | P13.Scale = Vector3.new(1, 0.5, 1) | |
357 | P13.Parent = P12 | |
358 | ||
359 | -- 14 - LP2 | |
360 | P14 = Instance.new("Part") | |
361 | P14.CFrame = CFrame.new(Vector3.new(18.1000004, 1.8499999, 11.6999998)) * CFrame.Angles(-0, 0, -0) | |
362 | P14.FormFactor = Enum.FormFactor.Custom | |
363 | P14.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
364 | P14.Anchored = true | |
365 | P14.BrickColor = BrickColor.new("Black") | |
366 | P14.Friction = 0.30000001192093 | |
367 | P14.Shape = Enum.PartType.Block | |
368 | P14.Name = "LP2" | |
369 | P14.Parent = P4 | |
370 | ||
371 | -- 15 - Mesh | |
372 | P15 = Instance.new("CylinderMesh") | |
373 | P15.Scale = Vector3.new(1, 0.5, 1) | |
374 | P15.Parent = P14 | |
375 | ||
376 | -- 16 - LP3 | |
377 | P16 = Instance.new("Part") | |
378 | P16.CFrame = CFrame.new(Vector3.new(18.3000011, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
379 | P16.FormFactor = Enum.FormFactor.Custom | |
380 | P16.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
381 | P16.Anchored = true | |
382 | P16.BrickColor = BrickColor.new("Black") | |
383 | P16.Friction = 0.30000001192093 | |
384 | P16.Shape = Enum.PartType.Block | |
385 | P16.Name = "LP3" | |
386 | P16.Parent = P4 | |
387 | ||
388 | -- 17 - Mesh | |
389 | P17 = Instance.new("CylinderMesh") | |
390 | P17.Scale = Vector3.new(1, 0.5, 1) | |
391 | P17.Parent = P16 | |
392 | ||
393 | P1.Parent = LP.Character | |
394 | P1:MakeJoints() | |
395 | return P1 | |
396 | end | |
397 | ||
398 | weldModel = function(model, unanchor, rooty) | |
399 | local parts = {} | |
400 | local function recurse(object) | |
401 | if object:IsA("BasePart") then | |
402 | table.insert(parts, object) | |
403 | end | |
404 | for _,child in pairs(object:GetChildren()) do | |
405 | recurse(child) | |
406 | end | |
407 | end | |
408 | recurse(model) | |
409 | ||
410 | local rootPart = rooty or parts[1] | |
411 | for _, part in pairs(parts) do | |
412 | local cframe = rootPart.CFrame:toObjectSpace(part.CFrame) | |
413 | local weld = Instance.new("Weld") | |
414 | weld.Part0 = rootPart | |
415 | weld.Part1 = part | |
416 | weld.C0 = cframe | |
417 | weld.Parent = rootPart | |
418 | end | |
419 | ||
420 | if unanchor then | |
421 | for _, part in pairs(parts) do | |
422 | part.Anchored = false | |
423 | part.CanCollide = false | |
424 | end | |
425 | end | |
426 | end | |
427 | ||
428 | weldItem = function(rootPart, Item, TheC0, unanchor, ParentItem) | |
429 | local cframe = TheC0 or rootPart.CFrame:toObjectSpace(Item.CFrame) | |
430 | local weld = Instance.new("Weld") | |
431 | weld.Name = "Weld" | |
432 | weld.Part0 = rootPart | |
433 | weld.Part1 = Item | |
434 | weld.C0 = cframe | |
435 | weld.Parent = ParentItem and Item or rootPart | |
436 | ||
437 | if unanchor then | |
438 | Item.Anchored = false | |
439 | end | |
440 | return weld, cframe | |
441 | end | |
442 | ||
443 | scaleModel = function(model, scale) | |
444 | local parts = {} | |
445 | local function recurse(object) | |
446 | if object:IsA("BasePart") then | |
447 | table.insert(parts, object) | |
448 | end | |
449 | for _,child in pairs(object:GetChildren()) do | |
450 | recurse(child) | |
451 | end | |
452 | end | |
453 | recurse(model) | |
454 | ||
455 | local top, bottom, left, right, back, front | |
456 | for _, part in pairs(parts) do | |
457 | if top == nil or top < part.Position.y then top = part.Position.y end | |
458 | if bottom == nil or bottom > part.Position.y then bottom = part.Position.y end | |
459 | if left == nil or left > part.Position.x then left = part.Position.x end | |
460 | if right == nil or right < part.Position.x then right = part.Position.x end | |
461 | if back == nil or back > part.Position.z then back = part.Position.z end | |
462 | if front == nil or front < part.Position.z then front = part.Position.z end | |
463 | end | |
464 | ||
465 | local middle = Vector3.new( left+right, top+bottom, back+front )/2 | |
466 | local minSize = Vector3.new(0.2, 0.2, 0.2) | |
467 | ||
468 | for _, part in pairs(parts) do | |
469 | local foo = part.CFrame.p - middle | |
470 | local rotation = part.CFrame - part.CFrame.p | |
471 | local newSize = part.Size*scale | |
472 | part.FormFactor = "Custom" | |
473 | part.Size = newSize | |
474 | part.CFrame = CFrame.new( middle + foo*scale ) * rotation | |
475 | ||
476 | if newSize.x < minSize.x or newSize.y < minSize.y or newSize.z < minSize.z then | |
477 | local mesh | |
478 | for _, child in pairs(part:GetChildren()) do | |
479 | if child:IsA("DataModelMesh") then | |
480 | mesh = child | |
481 | break | |
482 | end | |
483 | end | |
484 | ||
485 | if mesh == nil then | |
486 | mesh = Instance.new("BlockMesh", part) | |
487 | end | |
488 | ||
489 | local oScale = mesh.Scale | |
490 | local newScale = newSize/minSize * oScale | |
491 | if 0.2 < newSize.x then newScale = Vector3.new(1 * oScale.x, newScale.y, newScale.z) end | |
492 | if 0.2 < newSize.y then newScale = Vector3.new(newScale.x, 1 * oScale.y, newScale.z) end | |
493 | if 0.2 < newSize.z then newScale = Vector3.new(newScale.x, newScale.y, 1 * oScale.z) end | |
494 | ||
495 | mesh.Scale = newScale | |
496 | end | |
497 | end | |
498 | end | |
499 | ||
500 | function getMass(Obj, Total) | |
501 | local newTotal = Total | |
502 | local returnTotal = 0 | |
503 | ||
504 | if Obj:IsA("BasePart") then | |
505 | newTotal = newTotal + Objects[Obj] | |
506 | elseif BodyObjects[Obj.ClassName] then | |
507 | Obj:Destroy() | |
508 | end | |
509 | ||
510 | if Obj:GetChildren() and #Obj:GetChildren() > 0 then | |
511 | for _,v in pairs(Obj:GetChildren()) do | |
512 | returnTotal = returnTotal + getMass(v, newTotal) | |
513 | end | |
514 | else | |
515 | returnTotal = newTotal | |
516 | end | |
517 | ||
518 | return returnTotal | |
519 | end | |
520 | ||
521 | function getTargFromCurrent() | |
522 | local Current = Current.Part | |
523 | if Current:IsA("BasePart") then | |
524 | return Current | |
525 | elseif Current:findFirstChild("Torso") then | |
526 | return Current.Torso | |
527 | else | |
528 | for _,v in pairs(Current:GetChildren()) do | |
529 | if v:IsA("BasePart") then | |
530 | return v | |
531 | end | |
532 | end | |
533 | end | |
534 | end | |
535 | ||
536 | function Fire(Part, Vec, Inv) | |
537 | pcall(function() | |
538 | Current.BP:Destroy() | |
539 | Current.BP = nil | |
540 | end) | |
541 | pcall(function() | |
542 | Current.BA:Destroy() | |
543 | Current.BA = nil | |
544 | end) | |
545 | pcall(function() | |
546 | if Inv then | |
547 | Part.Velocity = -((Vec - Torso.Position).unit * Grav * 1.1) | |
548 | else | |
549 | Part.Velocity = ((Vec - Camera.CoordinateFrame.p).unit * Grav * 1.1) | |
550 | end | |
551 | Current.Mass = nil | |
552 | end) | |
553 | Reset() | |
554 | end | |
555 | ||
556 | function Reset() | |
557 | LS.Parent = nil | |
558 | RS.Parent = nil | |
559 | ||
560 | OrigLS.Parent = Torso | |
561 | OrigRS.Parent = Torso | |
562 | ||
563 | OrigLS.C0 = LS0 | |
564 | OrigRS.C0 = RS0 | |
565 | end | |
566 | ||
567 | function Start() | |
568 | Cor(function() | |
569 | repeat wait(1/30) until LP.Character and LP.Character.Parent == Workspace and LP.Character:findFirstChild("Torso") | |
570 | Char = LP.Character | |
571 | PlrGui = LP.PlayerGui | |
572 | Backpack = LP.Backpack | |
573 | Mouse = LP:GetMouse() | |
574 | ||
575 | for _,v in pairs(Cons) do | |
576 | v:disconnect() | |
577 | end | |
578 | Cons = {} | |
579 | ||
580 | Camera = Workspace.CurrentCamera | |
581 | LastCamCF = Camera.CoordinateFrame | |
582 | AnimJoints = {} | |
583 | mDown = false | |
584 | Multi = false | |
585 | Grabbing = false | |
586 | Current = {} | |
587 | Alpha = 1 | |
588 | ||
589 | Head = Char["Head"] | |
590 | Torso = Char["Torso"] | |
591 | Humanoid = Char["Humanoid"] | |
592 | LA = Char["Left Arm"] | |
593 | RA = Char["Right Arm"] | |
594 | LL = Char["Left Leg"] | |
595 | RL = Char["Right Leg"] | |
596 | ||
597 | OrigLS = Torso["Left Shoulder"] | |
598 | OrigRS = Torso["Right Shoulder"] | |
599 | ||
600 | for _,v in pairs(Char:GetChildren()) do | |
601 | if v.Name == ModID then | |
602 | v:Destroy() | |
603 | end | |
604 | end | |
605 | ||
606 | for _,v in pairs(PlrGui:GetChildren()) do | |
607 | if v.Name == "PadsGui" then | |
608 | v:Destroy() | |
609 | end | |
610 | end | |
611 | ||
612 | LS = Instance.new("Weld") | |
613 | RS = Instance.new("Weld") | |
614 | ||
615 | LS.Name = OrigLS.Name | |
616 | LS.Part0 = Torso | |
617 | LS.Part1 = LA | |
618 | LS.C0 = LS0 | |
619 | LS.C1 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0) | |
620 | ||
621 | RS.Name = OrigRS.Name | |
622 | RS.Part0 = Torso | |
623 | RS.Part1 = RA | |
624 | RS.C0 = RS0 | |
625 | RS.C1 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0) | |
626 | ||
627 | local Pads = MakePads() | |
628 | local LPad = Pads.LBase | |
629 | local RPad = Pads.RBase | |
630 | ||
631 | weldModel(LPad, true, LPad) | |
632 | weldModel(RPad, true, RPad) | |
633 | ||
634 | local GripWeldL = Instance.new("Weld") | |
635 | GripWeldL.Name = "GripWeldL" | |
636 | GripWeldL.Part0 = LA | |
637 | GripWeldL.Part1 = LPad | |
638 | GripWeldL.C0 = CFrame.new(0, -1.05, 0) * CFrame.Angles(0, math.rad(180), 0) | |
639 | GripWeldL.Parent = LA | |
640 | ||
641 | local GripWeldR = Instance.new("Weld") | |
642 | GripWeldR.Name = "GripWeldR" | |
643 | GripWeldR.Part0 = RA | |
644 | GripWeldR.Part1 = RPad | |
645 | GripWeldR.C0 = CFrame.new(0, -1.05, 0) * CFrame.Angles(0, math.rad(180), 0) | |
646 | GripWeldR.Parent = RA | |
647 | ||
648 | local isParts = false | |
649 | ||
650 | table.insert(Cons, Mouse.KeyDown:connect(function(Key) | |
651 | Key = Key:lower() | |
652 | if Key == "z" then | |
653 | --Stuff | |
654 | elseif Key == "f" then | |
655 | local Current = Current.Part | |
656 | if Current and Current.Parent ~= nil and not Multi then | |
657 | Current:BreakJoints() | |
658 | end | |
659 | elseif Key == "q" then | |
660 | if isParts then | |
661 | isParts = false | |
662 | for _,v in pairs(Workspace:GetChildren()) do | |
663 | if v.Name == "MyPartV" and v:IsA("BasePart") then | |
664 | v:Destroy() | |
665 | end | |
666 | end | |
667 | else | |
668 | isParts = true | |
669 | for i = 1, 50 do | |
670 | local Part = Instance.new("Part") | |
671 | Part.Color = Color3.new(math.random(), math.random(), math.random()) | |
672 | Part.Transparency = 0 | |
673 | Part.Size = Vector3.new(math.random(1, 3), math.random(1, 3), math.random(1, 3)) | |
674 | Part.Archivable = true | |
675 | Part.CanCollide = false | |
676 | Part.Material = "Plastic" | |
677 | Part.Locked = false | |
678 | Part.CFrame = Torso.CFrame * CFrame.new(math.random(-15, 15), -1, math.random(-15, 15)) | |
679 | Part.Anchored = true | |
680 | Part.Name = "MyPartV" | |
681 | Part.TopSurface = "Smooth" | |
682 | Part.BottomSurface = "Smooth" | |
683 | Part.Parent = Workspace | |
684 | end | |
685 | end | |
686 | elseif Key == "e" then | |
687 | local Targ; | |
688 | if Current.Part and Current.Part ~= nil then | |
689 | Targ = getTargFromCurrent() | |
690 | else | |
691 | Targ = LastPart | |
692 | end | |
693 | if Targ and Targ.Parent ~= nil and not Multi then | |
694 | local Ex = Instance.new("Explosion", Workspace) | |
695 | Ex.Position = Targ.CFrame.p | |
696 | Ex.BlastRadius = 16 | |
697 | Ex.DestroyJointRadiusPercent = 0.5 | |
698 | end | |
699 | elseif Key == "c" then | |
700 | if Current.Part and Current.Part.Parent ~= nil and not Multi then | |
701 | local Part = getTargFromCurrent() | |
702 | if Part then | |
703 | Grabbing = false | |
704 | if Mouse.Hit then | |
705 | local TargPos = CFrame.new(Camera.CoordinateFrame.p, Mouse.Hit.p) * CFrame.new(0, 0, -1000) | |
706 | Fire(Part, TargPos.p) | |
707 | else | |
708 | Fire(Part, Mouse.Origin.p + Mouse.UnitRay.Direction, true) | |
709 | end | |
710 | end | |
711 | end | |
712 | end | |
713 | end)) | |
714 | ||
715 | table.insert(Cons, Mouse.Button1Up:connect(function() | |
716 | mDown = false | |
717 | if Grabbing == true and Multi == false then | |
718 | Grabbing = false | |
719 | Reset() | |
720 | end | |
721 | if Current.Part ~= nil then | |
722 | LastPart = getTargFromCurrent() | |
723 | Current = {} | |
724 | end | |
725 | end)) | |
726 | ||
727 | local function makeLightning(Par, Start, End, Width, Length, RandomScale, ArcScale, Num1) | |
728 | local oldParts = {} | |
729 | for _,v in pairs(Par:GetChildren()) do | |
730 | v.CFrame = CFrame.new(5e5, 5e5, 5e5) | |
731 | table.insert(oldParts, v) | |
732 | end | |
733 | local Distance = (Start-End).Magnitude | |
734 | local ArcScale = ArcScale or 1 | |
735 | local RandomScale = RandomScale or 0 | |
736 | local Last = Start | |
737 | local IterNum = 0 | |
738 | ||
739 | while Par.Parent do | |
740 | IterNum = IterNum + 1 | |
741 | local New = nil | |
742 | if (Last-End).Magnitude < Length then | |
743 | New = CFrame.new(End) | |
744 | else | |
745 | if (End-Last).Magnitude < Length*2 then | |
746 | RandomScale = RandomScale*0.5 | |
747 | ArcScale = ArcScale*0.5 | |
748 | end | |
749 | local Direct = CFrame.new(Last,End) | |
750 | New = Direct*CFrame.Angles(math.rad(math.random(-RandomScale/4,RandomScale*ArcScale)),math.rad(math.random(-RandomScale,RandomScale)),math.rad(math.random(-RandomScale,RandomScale))) | |
751 | New = New*CFrame.new(0,0,-Length) | |
752 | end | |
753 | local Trail = nil | |
754 | if oldParts[IterNum] then | |
755 | Trail = oldParts[IterNum] | |
756 | Trail.BrickColor = ((Num1 % 2 == 0) and BrickColor.new("Crimson")) or BrickColor.new("Really black") | |
757 | Trail.Size = Vector3.new(Width, (Last-New.p).Magnitude, Width) | |
758 | Trail.CFrame = CFrame.new(New.p, Last)*CFrame.Angles(math.rad(90),0,0)*CFrame.new(0, -(Last-New.p).Magnitude/2, 0) | |
759 | oldParts[IterNum] = nil | |
760 | else | |
761 | Trail = Instance.new("Part") | |
762 | Trail.Name = "Part" | |
763 | Trail.FormFactor = "Custom" | |
764 | Trail.BrickColor = ((Num1 % 2 == 0) and BrickColor.new("Crimson")) or BrickColor.new("Really black") | |
765 | Trail.Transparency = 0 | |
766 | Trail.Anchored = true | |
767 | Trail.CanCollide = false | |
768 | Trail.Locked = true | |
769 | Trail.BackSurface = "SmoothNoOutlines" | |
770 | Trail.BottomSurface = "SmoothNoOutlines" | |
771 | Trail.FrontSurface = "SmoothNoOutlines" | |
772 | Trail.LeftSurface = "SmoothNoOutlines" | |
773 | Trail.RightSurface = "SmoothNoOutlines" | |
774 | Trail.TopSurface = "SmoothNoOutlines" | |
775 | Trail.Material = "Neon" | |
776 | Trail.Size = Vector3.new(Width, (Last-New.p).Magnitude, Width) | |
777 | Trail.CFrame = CFrame.new(New.p, Last)*CFrame.Angles(math.rad(90),0,0)*CFrame.new(0, -(Last-New.p).Magnitude/2, 0) | |
778 | Trail.Parent = Par | |
779 | end | |
780 | Last = New.p | |
781 | if (Last-End).Magnitude < 1 then | |
782 | break | |
783 | end | |
784 | end | |
785 | for _,v in pairs(oldParts) do | |
786 | v:Destroy() | |
787 | end | |
788 | end | |
789 | ||
790 | table.insert(Cons, Mouse.Button1Down:connect(function() | |
791 | mDown = true | |
792 | local Targ = Mouse.Target | |
793 | Cor(function() | |
794 | if Targ and Objects[Targ] and not Multi then | |
795 | Grabbing = true | |
796 | Current.Part = Targ | |
797 | local Mass = Objects[Targ] | |
798 | local ForceNum = 0 | |
799 | local Hum = nil | |
800 | ||
801 | for _,v in pairs(Targ:GetChildren()) do | |
802 | if BodyObjects[v.ClassName] then | |
803 | v:Destroy() | |
804 | end | |
805 | end | |
806 | ||
807 | for _,v in pairs(Workspace:GetChildren()) do | |
808 | if v:findFirstChild("Humanoid") and v:IsAncestorOf(Targ) then | |
809 | Hum = v.Humanoid | |
810 | Mass = getMass(v, 0) | |
811 | Current.Part = v | |
812 | break | |
813 | end | |
814 | end | |
815 | ||
816 | Current.Mass = Mass | |
817 | ||
818 | if not Hum then | |
819 | Targ:BreakJoints() | |
820 | end | |
821 | ||
822 | ForceNum = Mass * Grav | |
823 | Targ.CanCollide = true | |
824 | Targ.Anchored = false | |
825 | ||
826 | local BP = Instance.new("BodyPosition") | |
827 | BP.maxForce = Vector3.new(3 * ForceNum, 3 * ForceNum, 3 * ForceNum) | |
828 | BP.Parent = Targ | |
829 | ||
830 | local Ang = Instance.new("BodyAngularVelocity") | |
831 | Ang.Parent = Targ | |
832 | ||
833 | Current.BP = BP | |
834 | Current.BA = Ang | |
835 | ||
836 | OrigLS.Parent = nil | |
837 | OrigRS.Parent = nil | |
838 | ||
839 | LS.Parent = Torso | |
840 | RS.Parent = Torso | |
841 | ||
842 | LS.C0 = LS0 | |
843 | RS.C0 = RS0 | |
844 | ||
845 | local DirDot = Mouse.UnitRay.Direction:Dot(Targ.Position - Mouse.Origin.p) | |
846 | local BPPos = Vector3.new(0, 0, 0) | |
847 | local Vel = Vector3.new(0, 0, 0) | |
848 | local Vlev = random() * math.pi | |
849 | local RPos = Vector3.new(random() * 2 - 1, cos(Vlev), random() * 2 - 1) | |
850 | ||
851 | local Ball = Instance.new("Part") | |
852 | Ball.Name = "Ball" | |
853 | Ball.FormFactor = "Custom" | |
854 | Ball.Color = Color3.new(255, 0, 0) | |
855 | Ball.Transparency = 0.3 | |
856 | Ball.Anchored = true | |
857 | Ball.CanCollide = false | |
858 | Ball.Locked = true | |
859 | Ball.BottomSurface, Ball.TopSurface = "Smooth", "Smooth" | |
860 | Ball.Size = Vector3.new(0.5, 0.5, 0.5) | |
861 | Ball.CFrame = Torso.CFrame * CFrame.new(0, 1, -3) | |
862 | Ball.Parent = Char | |
863 | ||
864 | if Targ.Name == "MyPartV" then | |
865 | Targ.Name = "MyPartF" | |
866 | end | |
867 | ||
868 | local LightMod = Instance.new("Model", Char) | |
869 | ||
870 | local Mesh = Instance.new("SpecialMesh") | |
871 | Mesh.MeshType = "Sphere" | |
872 | Mesh.Parent = Ball | |
873 | ||
874 | local Size = 1 | |
875 | local Rise = true | |
876 | ||
877 | while Grabbing and BP and Ang and Targ.Parent ~= nil do | |
878 | local BPPos = Mouse.Origin.p + Mouse.UnitRay.Direction * DirDot | |
879 | Ang.angularvelocity = Vel | |
880 | BP.position = BPPos + RPos | |
881 | RPos = Vector3.new(max(-1, min(RPos.x + random() * 0.02 - 0.01, 1)), cos(Vlev), max(-1, min(RPos.z + random() * 0.02 - 0.01, 1))) | |
882 | Vel = Vector3.new(max(-1, min(Vel.x + random() * 0.2 - 0.1, 1)), max(-1, min(Vel.y + random() * 0.2 - 0.1, 1)), max(-1, min(Vel.z + random() * 0.2 - 0.1, 1))) | |
883 | Vlev = (Vlev + 0.05) % tau | |
884 | ||
885 | if Hum then | |
886 | Hum.Sit = true | |
887 | end | |
888 | ||
889 | if LA.Parent ~= nil and RA.Parent ~= nil then | |
890 | local LPos = (LA.CFrame * CFrame.new(0, -1, 0)).p | |
891 | local RPos = (RA.CFrame * CFrame.new(0, -1, 0)).p | |
892 | if Rise == true then | |
893 | if Size < 0.6 then | |
894 | Size = Size + 0.05 | |
895 | else | |
896 | Size = Size + 0.1 | |
897 | end | |
898 | if Size >= 2.2 then | |
899 | Rise = false | |
900 | end | |
901 | else | |
902 | if Size > 2.1 then | |
903 | Size = Size - 0.05 | |
904 | else | |
905 | Size = Size - 0.1 | |
906 | end | |
907 | if Size <= 0.5 then | |
908 | Rise = true | |
909 | end | |
910 | end | |
911 | Ball.Size = Vector3.new(Size, Size, Size) | |
912 | Ball.CFrame = CFrame.new(LPos:Lerp(RPos, 0.5), Targ.Position) * CFrame.new(0, 0, -2.2) | |
913 | LightNum = LightNum + 1 | |
914 | makeLightning(LightMod, Ball.Position, Targ.Position, 0.2, 4, 50, 1, LightNum) | |
915 | elseif Ball.Parent ~= nil then | |
916 | Ball:Destroy() | |
917 | end | |
918 | ||
919 | if LS and LS.Parent == Torso then | |
920 | LS.C0 = CFrame.new(Vector3.new(-1.5, 0.5, 0), Torso.CFrame:pointToObjectSpace((Targ.CFrame or Torso.CFrame * CFrame.new(-1.5, 0.5, 1)).p)) | |
921 | end | |
922 | if RS and RS.Parent == Torso then | |
923 | RS.C0 = CFrame.new(Vector3.new(1.5, 0.5, 0), Torso.CFrame:pointToObjectSpace((Targ.CFrame or Torso.CFrame * CFrame.new(1.5, 0.5, 1)).p)) | |
924 | end | |
925 | RunService.Heartbeat:wait() | |
926 | end | |
927 | ||
928 | coroutine.resume(coroutine.create(function() | |
929 | for i = 0.5, 1, 0.1 do | |
930 | for i2,v in pairs(LightMod:GetChildren()) do | |
931 | --v.Light.Range = 6-(i*5) | |
932 | v.Transparency = i | |
933 | end | |
934 | wait(1/30) | |
935 | end | |
936 | LightMod:Destroy() | |
937 | end)) | |
938 | ||
939 | if BP and BP.Parent ~= nil then | |
940 | BP:Destroy() | |
941 | end | |
942 | ||
943 | if Ang and Ang.Parent ~= nil then | |
944 | Ang:Destroy() | |
945 | end | |
946 | ||
947 | pcall(function() Ball:Destroy() end) | |
948 | end | |
949 | end) | |
950 | end)) | |
951 | end) | |
952 | end | |
953 | ||
954 | function Add(Obj) | |
955 | if Obj:IsA("BasePart") and not Objects[Obj] and not (Obj.Name == "Base" and Obj.ClassName == "Part") then | |
956 | Objects[Obj] = Obj:GetMass() | |
957 | Obj.Changed:connect(function(P) | |
958 | if P:lower() == "size" and Objects[Obj] and Obj.Parent ~= nil then | |
959 | Objects[Obj] = Obj:GetMass() | |
960 | end | |
961 | end) | |
962 | end | |
963 | end | |
964 | ||
965 | function Rem(Obj) | |
966 | if Objects[Obj] then | |
967 | Objects[Obj] = nil | |
968 | end | |
969 | end | |
970 | ||
971 | function Recursion(Obj) | |
972 | ypcall(function() | |
973 | Add(Obj) | |
974 | if #Obj:GetChildren() > 0 then | |
975 | for _,v in pairs(Obj:GetChildren()) do | |
976 | Recursion(v) | |
977 | end | |
978 | end | |
979 | end) | |
980 | end | |
981 | ||
982 | Workspace.DescendantAdded:connect(function(Obj) | |
983 | Add(Obj) | |
984 | end) | |
985 | ||
986 | Workspace.DescendantRemoving:connect(function(Obj) | |
987 | Rem(Obj) | |
988 | end) | |
989 | ||
990 | for _,v in pairs(Workspace:GetChildren()) do | |
991 | Recursion(v) | |
992 | end | |
993 | ||
994 | Start() | |
995 | ||
996 | if LP.Name == PlrName then | |
997 | LP.CharacterAdded:connect(Start) | |
998 | end |