· 8 years ago · Feb 25, 2018, 05:14 PM
1-- Synapse Decompiler
2-- Purchase Here: https://brack4712.xyz/synapse/purchase/
3
4local updatedate = "N/A"
5local updatestuff = "N/A"
6local updateversion = "N/A"
7pcall(function()
8 local game_data = game.ReplicatedFirst:WaitForChild("GameData")
9 updatedate = game_data:WaitForChild("UpdateDate", 3).Value
10 updatestuff = game_data:WaitForChild("UpdateLog", 3).Value
11 updateversion = game_data:WaitForChild("Version", 3).Value
12end)
13if game:GetService("RunService"):IsStudio() then
14 wait(1)
15end
16local updatemsg = "[Update date: " .. updatedate .. "]\n" .. updatestuff
17local lelasdids = {
18 [195329] = true,
19 [525919] = true,
20 [541489] = true,
21 [1667819] = true,
22 [4337002] = true,
23 [5725475] = true,
24 [9143169] = true,
25 [607954] = true,
26 [52250025] = true
27}
28leleltru = lelasdids[game:GetService("Players").LocalPlayer.UserId]
29wait()
30pcall(function()
31 local starterGui = game:GetService("StarterGui")
32 starterGui:SetCore("TopbarEnabled", false)
33end)
34local testing
35local loltime0 = 0
36local loltick0 = 0
37local loltimescale = 1
38local lolgravity = Vector3.new(0, -196.2, 0)
39local loltick = tick
40local function tick()
41 return loltimescale * (loltick() - loltick0) + loltime0
42end
43game.StarterGui.ResetPlayerGuiOnSpawn = false
44game.StarterGui:SetCoreGuiEnabled("All", false)
45require(script.ModelReplicator)
46math.randomseed(tick())
47local eventmod = {}
48local vector = {}
49local cframe = {}
50local network = {}
51local playerdata = {}
52local trash = {}
53local utility = {}
54local event = {}
55local sequencer = {}
56local physics = {}
57local particle = {}
58local sound = {}
59local effects = {}
60local tween = {}
61local animation = {}
62local input = {}
63aimassist = {}
64local char = {}
65local camera = {}
66local chat = {}
67local hud = {}
68local notify = {}
69local leaderboard = {}
70local replication = {}
71local menu = {}
72local roundsystem = {}
73local run = {}
74local gamelogic = {}
75local timemod = {}
76local require = require
77rpoclient = require(script.ModuleScript)
78repeat
79 wait()
80until game:IsLoaded()
81print("Loading eventmod module")
82function eventmod:ison()
83 return false
84end
85print("Loading vector module")
86do
87 local pi = math.pi
88 local cos = math.cos
89 local sin = math.sin
90 local acos = math.acos
91 local asin = math.asin
92 local atan2 = math.atan2
93 local random = math.random
94 local v3 = Vector3.new
95 local nv = Vector3.new()
96 vector.identity = nv
97 vector.new = v3
98 vector.lerp = nv.lerp
99 vector.cross = nv.Cross
100 vector.dot = nv.Dot
101 function vector.random(a, b)
102 local p = acos(1 - 2 * random()) / 3
103 local z = 1.7320508075688772 * sin(p) - cos(p)
104 local r = ((1 - z * z) * random()) ^ 0.5
105 local t = 6.28318 * random()
106 local x = r * cos(t)
107 local y = r * sin(t)
108 if b then
109 local m = (a + (b - a) * random()) / (x * x + y * y + z * z) ^ 0.5
110 return v3(m * x, m * y, m * z)
111 elseif a then
112 return v3(a * x, a * y, a * z)
113 else
114 return v3(x, y, z)
115 end
116 end
117 function vector.anglesyx(x, y)
118 local cx = cos(x)
119 return v3(-cx * sin(y), sin(x), -cx * cos(y))
120 end
121 function vector.toanglesyx(v)
122 local x, y, z = v.x, v.y, v.z
123 return asin(y / (x * x + y * y + z * z) ^ 0.5), atan2(-x, -z)
124 end
125 function vector.slerp(v0, v1, t)
126 local x0, y0, z0 = v0.x, v0.y, v0.z
127 local x1, y1, z1 = v1.x, v1.y, v1.z
128 local m0 = (x0 * x0 + y0 * y0 + z0 * z0) ^ 0.5
129 local m1 = (x1 * x1 + y1 * y1 + z1 * z1) ^ 0.5
130 local co = (x0 * x1 + y0 * y1 + z0 * z1) / (m0 * m1)
131 if co < -0.99999 then
132 local px, py, pz = 0, 0, 0
133 local x2, y2, z2 = x0 * x0, y0 * y0, z0 * z0
134 if x2 < y2 then
135 if x2 < z2 then
136 px = 1
137 else
138 pz = 1
139 end
140 elseif y2 < z2 then
141 py = 1
142 else
143 pz = 1
144 end
145 local th = acos((x0 * px + y0 * py + z0 * pz) / m0)
146 local r = pi / th * t
147 local s = ((1 - t) * m0 + t * m1) / sin(th)
148 local s0 = s / m0 * sin((1 - r) * th)
149 local s1 = s / m1 * sin(r * th)
150 return v3(s0 * x0 + s1 * px, s0 * y0 + s1 * py, s0 * z0 + s1 * pz)
151 elseif co < 0.99999 then
152 local th = acos(co)
153 local s = ((1 - t) * m0 + t * m1) / (1 - co * co) ^ 0.5
154 local s0 = s / m0 * sin((1 - t) * th)
155 local s1 = s / m1 * sin(t * th)
156 return v3(s0 * x0 + s1 * x1, s0 * y0 + s1 * y1, s0 * z0 + s1 * z1)
157 elseif m0 > 1.0E-5 or m1 > 1.0E-5 then
158 if m0 < m1 then
159 return ((1 - t) * m0 / m1 + t) * v1
160 else
161 return (1 - t + t * m1 / m0) * v0
162 end
163 else
164 return nv
165 end
166 end
167end
168print("Loading cframe module")
169do
170 local pi = math.pi
171 local halfpi = pi / 2
172 local cos = math.cos
173 local sin = math.sin
174 local acos = math.acos
175 local v3 = Vector3.new
176 local nv = v3()
177 local cf = CFrame.new
178 local nc = cf()
179 local components = nc.components
180 local tos = nc.toObjectSpace
181 local vtos = nc.vectorToObjectSpace
182 local ptos = nc.pointToObjectSpace
183 local backcf = cf(0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0, -1)
184 local lerp = nc.lerp
185 cframe.identity = nc
186 cframe.new = cf
187 cframe.vtws = nc.vectorToWorldSpace
188 cframe.tos = nc.toObjectSpace
189 cframe.ptos = nc.pointToObjectSpace
190 cframe.vtos = nc.vectorToObjectSpace
191 function cframe.fromaxisangle(x, y, z)
192 if not y then
193 x, y, z = x.x, x.y, x.z
194 end
195 local m = (x * x + y * y + z * z) ^ 0.5
196 if m > 1.0E-5 then
197 local si = sin(m / 2) / m
198 return cf(0, 0, 0, si * x, si * y, si * z, cos(m / 2))
199 else
200 return nc
201 end
202 end
203 function cframe.toaxisangle(c)
204 local _, _, _, xx, yx, zx, xy, yy, zy, xz, yz, zz = components(c)
205 local co = (xx + yy + zz - 1) / 2
206 if co < -0.99999 then
207 local x = xx + yx + zx + 1
208 local y = xy + yy + zy + 1
209 local z = xz + yz + zz + 1
210 local m = pi * (x * x + y * y + z * z) ^ (-0.5)
211 return v3(m * x, m * y, m * z)
212 elseif co < 0.99999 then
213 local x = yz - zy
214 local y = zx - xz
215 local z = xy - yx
216 local m = acos(co) * (x * x + y * y + z * z) ^ (-0.5)
217 return v3(m * x, m * y, m * z)
218 else
219 return nv
220 end
221 end
222 function cframe.direct(c, look, newdir, t)
223 local lx, ly, lz = look.x, look.y, look.z
224 local rv = vtos(c, newdir)
225 local rx, ry, rz = rv.x, rv.y, rv.z
226 local rl = ((rx * rx + ry * ry + rz * rz) * (lx * lx + ly * ly + lz * lz)) ^ 0.5
227 local d = (lx * rx + ly * ry + lz * rz) / rl
228 if d < -0.99999 then
229 return c * backcf
230 elseif d < 0.99999 then
231 if t then
232 local th = t * acos(d) / 2
233 local qw = cos(th)
234 local m = rl * ((1 - d * d) / (1 - qw * qw)) ^ 0.5
235 return c * cf(0, 0, 0, (ly * rz - lz * ry) / m, (lz * rx - lx * rz) / m, (lx * ry - ly * rx) / m, qw)
236 else
237 local qw = ((d + 1) / 2) ^ 0.5
238 local m = 2 * qw * rl
239 return c * cf(0, 0, 0, (ly * rz - lz * ry) / m, (lz * rx - lx * rz) / m, (lx * ry - ly * rx) / m, qw)
240 end
241 else
242 return c
243 end
244 end
245 function cframe.toquaternion(c)
246 local x, y, z, xx, yx, zx, xy, yy, zy, xz, yz, zz = components(c)
247 local tr = xx + yy + zz
248 if tr > 2.99999 then
249 return x, y, z, 0, 0, 0, 1
250 elseif tr > -0.99999 then
251 local m = 2 * (tr + 1) ^ 0.5
252 return x, y, z, (yz - zy) / m, (zx - xz) / m, (xy - yx) / m, m / 4
253 else
254 local qx = xx + yx + zx + 1
255 local qy = xy + yy + zy + 1
256 local qz = xz + yz + zz + 1
257 local m = (qx * qx + qy * qy + qz * qz) ^ 0.5
258 return x, y, z, qx / m, qy / m, qz / m, 0
259 end
260 end
261 function cframe.power(c, t)
262 return lerp(nc, c, t)
263 end
264 cframe.interpolate = lerp
265 function cframe.interpolator(c0, c1, c2)
266 if c2 then
267 return function(t)
268 return lerp(lerp(c0, c1, t), lerp(c1, c2, t), t)
269 end
270 elseif c1 then
271 return function(t)
272 return lerp(c0, c1, t)
273 end
274 else
275 return function(t)
276 return lerp(nc, c0, t)
277 end
278 end
279 end
280 function cframe.jointleg(r0, r1, c, p, a)
281 local t = ptos(c, p)
282 local tx, ty, tz = t.x, t.y, t.z
283 local d = (tx * tx + ty * ty + tz * tz) ^ 0.5
284 local nx, ny, nz = tx / d, ty / d, tz / d
285 d = d > r0 + r1 and r0 + r1 or d
286 local l = (r1 * r1 - r0 * r0 - d * d) / (2 * r0 * d)
287 local h = -(1 - l * l) ^ 0.5
288 local m = (2 * (1 + h * ny + l * nz)) ^ 0.5
289 local qw, qx, qy, qz = m / 2, (h * nz - l * ny) / m, l * nx / m, -h * nx / m
290 if a then
291 local co, si = cos(a / 2), sin(a / 2)
292 qw, qx, qy, qz = co * qw - si * (nx * qx + ny * qy + nz * qz), co * qx + si * (nx * qw - nz * qy + ny * qz), co * qy + si * (ny * qw + nz * qx - nx * qz), co * qz + si * (nz * qw - ny * qx + nx * qy)
293 end
294 local g = (d * l + r0) / (d * d + 2 * d * l * r0 + r0 * r0) ^ 0.5
295 local co = ((1 - g) / 2) ^ 0.5
296 local si = -((1 + g) / 2) ^ 0.5
297 return c * cf(-r0 * 2 * (qx * qz + qy * qw), r0 * 2 * (qx * qw - qy * qz), r0 * (2 * (qx * qx + qy * qy) - 1), co * qx + si * qw, co * qy + si * qz, co * qz - si * qy, co * qw - si * qx)
298 end
299 function cframe.jointarm(r0, r1, c, p, a)
300 local t = ptos(c, p)
301 local tx, ty, tz = t.x, t.y, t.z
302 local d = (tx * tx + ty * ty + tz * tz) ^ 0.5
303 local nx, ny, nz = tx / d, ty / d, tz / d
304 d = d > r0 + r1 and r0 + r1 or d
305 local l = (r1 * r1 - r0 * r0 - d * d) / (2 * r0 * d)
306 local h = (1 - l * l) ^ 0.5
307 local m = (2 * (1 + h * ny + l * nz)) ^ 0.5
308 local qw, qx, qy, qz = m / 2, (h * nz - l * ny) / m, l * nx / m, -h * nx / m
309 if a then
310 local co, si = cos(a / 2), sin(a / 2)
311 qw, qx, qy, qz = co * qw - si * (nx * qx + ny * qy + nz * qz), co * qx + si * (nx * qw - nz * qy + ny * qz), co * qy + si * (ny * qw + nz * qx - nx * qz), co * qz + si * (nz * qw - ny * qx + nx * qy)
312 end
313 local g = (d * l + r0) / (d * d + 2 * d * l * r0 + r0 * r0) ^ 0.5
314 local co = ((1 - g) / 2) ^ 0.5
315 local si = ((1 + g) / 2) ^ 0.5
316 return c * cf(-r0 * 2 * (qx * qz + qy * qw), r0 * 2 * (qx * qw - qy * qz), r0 * (2 * (qx * qx + qy * qy) - 1), co * qx + si * qw, co * qy + si * qz, co * qz - si * qy, co * qw - si * qx), c * cf(0, 0, 0, qx, qy, qz, qw)
317 end
318end
319local sphereraycast
320do
321 local testinterval = 16
322 local inf = 1 / 0
323 local sort = table.sort
324 local v3 = Vector3.new
325 local nv = v3()
326 local dot = nv.Dot
327 local cross = nv.Cross
328 local cf = CFrame.new
329 local nc = cf()
330 local ptos = nc.pointToObjectSpace
331 local vtos = nc.vectorToObjectSpace
332 local vtws = nc.vectorToWorldSpace
333 local r3 = Region3.new
334 local workspace = game.Workspace
335 local boxcast = workspace.FindPartsInRegion3
336 local getchildren = game.GetChildren
337 local robloxtype = game.IsA
338 local boxmesh = {
339 {
340 p = 0.5,
341 n = v3(-1, 0, 0)
342 },
343 {
344 p = 0.5,
345 n = v3(1, 0, 0)
346 },
347 {
348 p = 0.5,
349 n = v3(0, -1, 0)
350 },
351 {
352 p = 0.5,
353 n = v3(0, 1, 0)
354 },
355 {
356 p = 0.5,
357 n = v3(0, 0, -1)
358 },
359 {
360 p = 0.5,
361 n = v3(0, 0, 1)
362 }
363 }
364 local wedgemesh = {
365 {
366 p = 0.5,
367 n = v3(-1, 0, 0)
368 },
369 {
370 p = 0.5,
371 n = v3(1, 0, 0)
372 },
373 {
374 p = 0.5,
375 n = v3(0, -1, 0)
376 },
377 {
378 p = 0,
379 n = v3(0, 0.7071067811865476, -0.7071067811865476)
380 },
381 {
382 p = 0.5,
383 n = v3(0, 0, 1)
384 }
385 }
386 local cornerwedgemesh = {
387 {
388 p = 0.5,
389 n = v3(1, 0, 0)
390 },
391 {
392 p = 0.5,
393 n = v3(0, -1, 0)
394 },
395 {
396 p = 0.5,
397 n = v3(0, 0, -1)
398 },
399 {
400 p = 0,
401 n = v3(0, 0.7071067811865476, 0.7071067811865476)
402 },
403 {
404 p = 0,
405 n = v3(-0.7071067811865476, 0.7071067811865476, 0)
406 }
407 }
408 local function solveplanesphereray(p, n, o, d, r)
409 local no = dot(n, o)
410 local dn = dot(d, n)
411 local t = (p + r - no) / dn
412 local v = o + t * d
413 local h = v - r * n
414 return v, t, h, n
415 end
416 local function solveraysphereray(ro, rd, so, sd, r)
417 local rdro = dot(rd, ro)
418 local roro = dot(ro, ro)
419 local rdsd = dot(rd, sd)
420 local rosd = dot(ro, sd)
421 local rdso = dot(rd, so)
422 local roso = dot(ro, so)
423 local sdso = dot(sd, so)
424 local soso = dot(so, so)
425 local m = rdro - rdso
426 local a = 1 - rdsd * rdsd
427 local b = 2 * (rdsd * m - rosd + sdso)
428 local c = roro - 2 * roso + soso - m * m - r * r
429 local d = -b / (2 * a)
430 local e2 = d * d - c / a
431 if e2 > 0 then
432 local t = d - e2 ^ 0.5
433 local s = rdsd * t - m
434 local v = so + t * sd
435 local h = ro + s * rd
436 local n = (v - h) / r
437 return v, t, h, n
438 end
439 end
440 local function solvepointsphereray(p, o, d, r)
441 local oo = dot(o, o)
442 local od = dot(o, d)
443 local op = dot(o, p)
444 local dp = dot(d, p)
445 local pp = dot(p, p)
446 local b = 2 * (od - dp)
447 local c = oo - 2 * op + pp - r * r
448 local g = -b / 2
449 local e2 = g * g - c
450 if e2 > 0 then
451 local t = g - e2 ^ 0.5
452 local v = o + t * d
453 local n = (v - p) / r
454 return v, t, p, n
455 end
456 end
457 local function solvespheresphereray(p, e, o, d, r)
458 local oo = dot(o, o)
459 local od = dot(o, d)
460 local op = dot(o, p)
461 local dp = dot(d, p)
462 local pp = dot(p, p)
463 local b = 2 * (od - dp)
464 local c = oo - 2 * op + pp - (r + e) * (r + e)
465 local g = -b / 2
466 local e2 = g * g - c
467 if e2 > 0 then
468 local t = g - e2 ^ 0.5
469 local v = o + t * d
470 local h = p + e / (r + e) * (v - p)
471 local n = (v - h) / (r + e)
472 return v, t, h, n
473 end
474 end
475 local function distplanesphereray(p, n, o, d, r)
476 local no = dot(n, o)
477 local dn = dot(d, n)
478 local t = (p + r - no) / dn
479 return t
480 end
481 local function distpointsphereray(p, o, d, r)
482 local oo = dot(o, o)
483 local od = dot(o, d)
484 local op = dot(o, p)
485 local dp = dot(d, p)
486 local pp = dot(p, p)
487 local b = 2 * (od - dp)
488 local c = oo - 2 * op + pp - r * r
489 local g = -b / 2
490 local e2 = g * g - c
491 if e2 > 0 then
492 local t = g - e2 ^ 0.5
493 return t
494 end
495 end
496 local function solveplaneplane(ap, an, bp, bn)
497 local anbn = dot(an, bn)
498 local canab = cross(an, bn)
499 local s = 1 - anbn * anbn
500 local o = (ap - anbn * bp) / s * an + (bp - ap * anbn) / s * bn
501 local d = canab / s ^ 0.5
502 return o, d
503 end
504 local function solverayplane(o, d, p, n)
505 local dn = dot(d, n)
506 local no = dot(n, o)
507 local v = o + (p - no) / dn * d
508 return v
509 end
510 local function distpointplane(v, p, n)
511 local vn = dot(v, n)
512 local t = vn - p
513 return t
514 end
515 local function sortgreaterdist(a, b)
516 return (b.dist or -inf) < (a.dist or -inf)
517 end
518 local function solvemeshsphereray(rawmesh, cframe, scale, origin, direction, radius)
519 local o = ptos(cframe, origin)
520 local d = vtos(cframe, direction)
521 local r = radius
522 local mesh = {}
523 local nfront = 0
524 for i = 1, #rawmesh do
525 local plane = rawmesh[i]
526 local sn = plane.n / scale
527 local n = sn.unit
528 local p = plane.p / sn.magnitude
529 local newplane = {p = p, n = n}
530 if dot(n, d) < 0 then
531 newplane.dist = distplanesphereray(p, n, o, d, r)
532 nfront = nfront + 1
533 end
534 mesh[#mesh + 1] = newplane
535 end
536 sort(mesh, sortgreaterdist)
537 for i = 1, nfront do
538 local aplane = mesh[i]
539 local apos, adist, ahit, anorm = solveplanesphereray(aplane.p, aplane.n, o, d, r)
540 local agood = true
541 for j = 1, #mesh do
542 if i ~= j then
543 local bplane = mesh[j]
544 if 0 < distpointplane(ahit, bplane.p, bplane.n) then
545 agood = false
546 local aborigin, abdirection = solveplaneplane(aplane.p, aplane.n, bplane.p, bplane.n)
547 local abpos, abdist, abhit, abnorm = solveraysphereray(aborigin, abdirection, o, d, r)
548 if abpos then
549 local abgood = true
550 for k = 1, #mesh do
551 if i ~= k and j ~= k then
552 local cplane = mesh[k]
553 local dist = distpointplane(abhit, cplane.p, cplane.n)
554 if dist > 0 then
555 abgood = false
556 local abcpoint = solverayplane(aborigin, abdirection, cplane.p, cplane.n)
557 local abcpos, abcdist, abchit, abcnorm = solvepointsphereray(abcpoint, o, d, r)
558 if abcpos then
559 local abcgood = true
560 for l = 1, #mesh do
561 if i ~= l and j ~= l and k ~= l then
562 local dplane = mesh[l]
563 local dist = distpointplane(abchit, dplane.p, dplane.n)
564 if dist > 0 then
565 abcgood = false
566 break
567 end
568 end
569 end
570 if abcgood then
571 return cframe * abcpos, abcdist, cframe * abchit, vtws(cframe, abcnorm)
572 end
573 end
574 end
575 end
576 end
577 if abgood then
578 return cframe * abpos, abdist, cframe * abhit, vtws(cframe, abnorm)
579 end
580 end
581 end
582 end
583 end
584 if agood then
585 return cframe * apos, adist, cframe * ahit, vtws(cframe, anorm)
586 end
587 end
588 end
589 local sortdist = function(a, b)
590 return a.dist < b.dist
591 end
592 local function solvepartsphereray(part, origin, direction, radius)
593 local class = part.ClassName
594 if class == "Part" then
595 local shape = part.Shape.Name
596 if shape == "Block" then
597 return solvemeshsphereray(boxmesh, part.CFrame, part.Size, origin, direction, radius)
598 elseif shape == "Ball" or shape == "Cylinder" then
599 return solvespheresphereray(part.Position, part.Size.x / 2, origin, direction, radius)
600 end
601 elseif class == "TrussPart" then
602 return solvemeshsphereray(boxmesh, part.CFrame, part.Size, origin, direction, radius)
603 elseif class == "WedgePart" then
604 return solvemeshsphereray(wedgemesh, part.CFrame, part.Size, origin, direction, radius)
605 elseif class == "CornerWedgePart" then
606 return solvemeshsphereray(cornerwedgemesh, part.CFrame, part.Size, origin, direction, radius)
607 end
608 end
609 local function getallparts(directory)
610 local shit = {directory}
611 local i = 0
612 while i < #shit do
613 i = i + 1
614 local children = getchildren(shit[i])
615 for j = 1, #children do
616 shit[#shit + 1] = children[j]
617 end
618 end
619 local parts = {}
620 for j = 1, #shit do
621 if robloxtype(shit[j], "BasePart") then
622 parts[#parts + 1] = shit[j]
623 end
624 end
625 return parts
626 end
627 function sphereraycast(origin, direction, radius, ignore)
628 local tested = {}
629 if type(ignore) == "table" then
630 for i = 1, #ignore do
631 local parts = getallparts(ignore[i])
632 for j = 1, #parts do
633 tested[parts[j]] = true
634 end
635 end
636 elseif ignore then
637 local parts = getallparts(ignore)
638 for j = 1, #parts do
639 tested[parts[j]] = true
640 end
641 end
642 local interval = testinterval
643 local length = direction.magnitude
644 local udirection = direction.unit
645 local dx = udirection.x
646 local dy = udirection.y
647 local dz = udirection.z
648 local radvec = v3(radius, radius, radius)
649 local absvec = v3(dx < 0 and -dx or dx, dy < 0 and -dy or dy, dz < 0 and -dz or dz)
650 local t = 0
651 repeat
652 local stop
653 if interval > length - t then
654 stop = true
655 interval = length - t
656 end
657 local lower = origin + (t + interval / 2) * udirection - interval / 2 * absvec - radvec
658 local upper = origin + (t + interval / 2) * udirection + interval / 2 * absvec + radvec
659 t = t + interval
660 local parts = boxcast(workspace, r3(lower, upper), nil, 100)
661 local sorted = {}
662 for i = 1, #parts do
663 local part = parts[i]
664 if not tested[part] then
665 tested[part] = true
666 local dist = distpointsphereray(part.Position, origin, udirection, radius + part.Size.magnitude / 2)
667 if dist then
668 sorted[#sorted + 1] = {part = part, dist = dist}
669 end
670 end
671 end
672 sort(sorted, sortdist)
673 local bestdist = direction.magnitude
674 local bestpart, bestpos, besthit, bestnorm
675 for i = 1, #sorted do
676 local package = sorted[i]
677 if bestdist > package.dist then
678 local pos, dist, hit, norm = solvepartsphereray(package.part, origin, udirection, radius)
679 if dist and dist > 0 and bestdist > dist then
680 bestdist = dist
681 bestpart = package.part
682 bestpos = pos
683 besthit = hit
684 bestnorm = norm
685 end
686 else
687 break
688 end
689 end
690 if bestpos then
691 return bestpart, bestpos, bestdist, besthit, bestnorm
692 end
693 until stop
694 end
695end
696print("Loading serializer")
697local serialize
698repeat
699 do break end
700 while true do
701 end
702until true
703do
704 local totalasd = 0
705 local starttick = tick()
706 local off = 48
707 local function newbitwriter(key)
708 key = key and key % 2251799813685248 or 0
709 local char = string.char
710 local concat = table.concat
711 local data = {}
712 local ndata = 0
713 local rem = 0
714 local nrem = 0
715 return function(nbits, bits)
716 if nbits < 32 then
717 bits = (bits + key) % 2 ^ nbits
718 else
719 local bits0 = bits % 4294967296
720 local bits1 = (bits - bits0) / 4294967296
721 bits0 = (bits0 + key) % 4294967296
722 bits1 = (bits1 + key) % 2 ^ (nbits - 32)
723 bits = bits0 + 4294967296 * bits1
724 end
725 while nrem + nbits >= 48 do
726 local r = bits % 2 ^ (48 - nrem)
727 bits = (bits - r) / 2 ^ (48 - nrem)
728 nbits = nbits - (48 - nrem)
729 rem = rem + r * 2 ^ nrem
730 local b0 = rem % 64
731 rem = (rem - b0) / 64
732 local b1 = rem % 64
733 rem = (rem - b1) / 64
734 local b2 = rem % 64
735 rem = (rem - b2) / 64
736 local b3 = rem % 64
737 rem = (rem - b3) / 64
738 local b4 = rem % 64
739 rem = (rem - b4) / 64
740 local b5 = rem % 64
741 rem = (rem - b5) / 64
742 local b6 = rem % 64
743 rem = (rem - b6) / 64
744 local b7 = rem % 64
745 rem = (rem - b7) / 64
746 rem = 0
747 nrem = 0
748 ndata = ndata + 1
749 data[ndata] = char(b0 + off, b1 + off, b2 + off, b3 + off, b4 + off, b5 + off, b6 + off, b7 + off)
750 end
751 rem = rem + bits * 2 ^ nrem
752 nrem = nrem + nbits
753 end, function()
754 if nrem ~= 0 then
755 local final = ""
756 for i = 1, 8 do
757 local b = rem % 64
758 rem = (rem - b) / 64
759 final = final .. char(b + off)
760 end
761 ndata = ndata + 1
762 data[ndata] = final
763 end
764 return concat(data)
765 end
766 end
767 local type = type
768 local pcall = pcall
769 local tostring = tostring
770 local byte = string.byte
771 local frexp = math.frexp
772 local nan = tostring(0 / 0)
773 function serialize(d, key)
774 local asd = tick()
775 local e = {}
776 local m = 0
777 local s = {}
778 local n = 0
779 local w, x = newbitwriter(key)
780 local userdata = {
781 function(v)
782 local t0 = v.Dot
783 return {
784 v.x,
785 v.y,
786 v.z
787 }
788 end,
789 function(v)
790 return {
791 v:components()
792 }
793 end,
794 function(v)
795 return v.UserId
796 end
797 }
798 local function f(d)
799 local t = type(d)
800 if s[d] then
801 w(3, 0)
802 local a, b = frexp(s[d])
803 w(5, b)
804 w(b, s[d])
805 elseif t == "boolean" then
806 w(3, 1)
807 w(1, d and 1 or 0)
808 elseif t == "number" then
809 if d % 1 == 0 and d > -4294967296 and d < 4294967296 then
810 w(3, 2)
811 local a, b = frexp(d)
812 w(5, b)
813 w(1, d < 0 and 1 or 0)
814 w(b, d < 0 and -d or d)
815 else
816 w(3, 3)
817 if d ~= d then
818 if tostring(d) == nan then
819 w(1, 0)
820 else
821 w(1, 1)
822 end
823 w(11, 0)
824 w(52, 1)
825 elseif d == 1 / 0 or d == -1 / 0 then
826 w(1, d < 0 and 1 or 0)
827 w(11, 2047)
828 w(52, 4503599627370495)
829 else
830 w(1, d < 0 and 1 or 0)
831 local a, b = frexp(d < 0 and -d or d)
832 local c = (2 * a - 1) * 4503599627370496
833 w(11, b - 1 + 1023)
834 if b == 1025 and c == 4503599627370495 then
835 w(52, (2 * a - 1) * 4503599627370496 - 1)
836 else
837 w(52, (2 * a - 1) * 4503599627370496)
838 end
839 end
840 end
841 elseif t == "string" then
842 n = n + 1
843 s[d] = n
844 w(3, 4)
845 local a, b = frexp(#d)
846 w(5, b)
847 w(b, #d)
848 for i = 1, #d do
849 local v = byte(d, i)
850 w(8, v)
851 end
852 elseif t == "table" then
853 n = n + 1
854 s[d] = n
855 w(3, 5)
856 local j = 0
857 local k = 0
858 for i = 1, #d do
859 if not d[i] then
860 j = i - 1
861 break
862 end
863 end
864 for i, v in next, d, nil do
865 local t = type(i)
866 if t ~= "number" or i > j then
867 k = k + 1
868 end
869 end
870 local a, b = frexp(j)
871 w(5, b)
872 w(b, j)
873 local a, b = frexp(k)
874 w(5, b)
875 w(b, k)
876 for i = 1, j do
877 f(d[i])
878 end
879 for i, v in next, d, nil do
880 local t = type(i)
881 if t ~= "number" or i > j then
882 f(i)
883 f(v)
884 end
885 end
886 else
887 local u = false
888 for i = 1, #userdata do
889 local a, b = pcall(userdata[i], d)
890 if a and b then
891 w(3, 6)
892 w(5, i)
893 f(b)
894 u = true
895 break
896 end
897 end
898 if not u then
899 m = m + 1
900 e[m] = d
901 w(3, 7)
902 local a, b = frexp(m)
903 w(5, b)
904 w(b, m)
905 end
906 end
907 end
908 f(d)
909 local out = x()
910 totalasd = tick() - asd
911 return out, e
912 end
913end
914print("Loading network module")
915do
916 local tick = tick
917 local player = game:GetService("Players").LocalPlayer
918 local remoteevent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
919 local bounceevent = game.ReplicatedStorage:WaitForChild("BounceEvent")
920 local remotefunc = game.ReplicatedStorage:WaitForChild("RemoteFunction")
921 local fireserver = remoteevent.FireServer
922 local invokeserver = remotefunc.InvokeServer
923 local key = 1
924 local funcs = {}
925 local queue = {}
926 function network:add(name, func)
927 funcs[name] = func
928 if queue[name] then
929 for i = 1, #queue[name] do
930 func(unpack(queue[name][i]))
931 end
932 end
933 end
934 local function getkey()
935 key = 94906230 * key % 94906249
936 return key
937 end
938 function network:send(name, ...)
939 fireserver(remoteevent, serialize({
940 name = name,
941 ...
942 }, getkey()))
943 end
944 function network:bounce(name, ...)
945 fireserver(bounceevent, serialize({
946 name = name,
947 ...
948 }, getkey()))
949 end
950 function network:fetch(name, ...)
951 return invokeserver(remotefunc, serialize({
952 name = name,
953 ...
954 }, getkey()))
955 end
956 function network:e(message)
957 network:send("c" .. "l" .. "o" .. "s" .. "e" .. "c" .. "o" .. "n" .. "n" .. "e" .. "c" .. "t" .. "i" .. "o" .. "n", message)
958 end
959 local function call(name, ...)
960 if funcs[name] then
961 funcs[name](...)
962 else
963 if not queue[name] then
964 queue[name] = {}
965 end
966 queue[name][#queue[name] + 1] = {
967 ...
968 }
969 end
970 end
971 bounceevent.OnClientEvent:connect(function(name, ...)
972 if funcs[name] then
973 return funcs[name](...)
974 else
975 if not queue[name] then
976 queue[name] = {}
977 end
978 queue[name][#queue[name] + 1] = {
979 ...
980 }
981 end
982 end)
983 remoteevent.OnClientEvent:connect(call)
984 network:add("ping", function(servertick)
985 network:send("p" .. "i" .. "n" .. "g", servertick, tick())
986 end)
987end
988print("Loading data module")
989do
990 local sub = string.sub
991 local find = string.find
992 local concat = table.concat
993 local type = type
994 local player = game:GetService("Players").LocalPlayer
995 local repstore = game.ReplicatedStorage
996 local gunmodules = repstore.GunModules
997 local userdatareaders = {}
998 local userdatawriters = {}
999 local cache = {}
1000 local function read(data, s)
1001 s = s or 1
1002 local nameend = find(data, "-", s)
1003 local numend = find(data, ":", nameend + 1)
1004 local type = sub(data, s, nameend - 1)
1005 local len = sub(data, nameend + 1, numend - 1) + 0
1006 local a, b = numend + 1, numend + len
1007 if type == "b" then
1008 return sub(data, a, a) == "t", b
1009 elseif type == "n" then
1010 return sub(data, a, b) + 0, b
1011 elseif type == "s" then
1012 return sub(data, a, b), b
1013 elseif type == "t" then
1014 local table, n = {}, 0
1015 local i = a
1016 while b >= i do
1017 local value, e = read(data, i)
1018 local sep = sub(data, e + 1, e + 1)
1019 if sep == "=" then
1020 local index = value
1021 value, e = read(data, e + 2)
1022 table[index] = value
1023 else
1024 n = n + 1
1025 table[n] = value
1026 end
1027 i = e + 2
1028 end
1029 return table, b
1030 else
1031 return userdatareaders[type](data, a, b), b
1032 end
1033 end
1034 local function write(data)
1035 local dtype = type(data)
1036 if dtype == "boolean" then
1037 return data and "b-4:true" or "b-5:false", dtype
1038 elseif dtype == "number" then
1039 local str = data .. ""
1040 return "n-" .. #str .. ":" .. str, dtype
1041 elseif dtype == "string" then
1042 local lab = "s-" .. #data .. ":"
1043 return lab .. data, dtype
1044 elseif dtype == "table" then
1045 local string, n = {}, 1
1046 local len = 0
1047 local i = 1
1048 while data[i] do
1049 local str = write(data[i]) .. ";"
1050 n = n + 1
1051 string[n] = str
1052 len = len + #str
1053 i = i + 1
1054 end
1055 for k, v in next, data, nil do
1056 if type(k) ~= "number" or k > i or k % 1 ~= 0 then
1057 local str = write(k) .. "=" .. write(v) .. ";"
1058 n = n + 1
1059 string[n] = str
1060 len = len + #str
1061 else
1062 print(k)
1063 end
1064 end
1065 string[1] = "t-" .. len .. ":"
1066 return concat(string), dtype
1067 else
1068 for i, v in next, userdatawriters, nil do
1069 local ser = userdatawriters[i](data)
1070 if ser then
1071 return ser, i
1072 end
1073 end
1074 end
1075 end
1076 network:add("loadplayerdata", function(data)
1077 cache = data
1078 playerdata.loaded = true
1079 end)
1080 network:add("updateplayerdata", function(value, ...)
1081 local keys = {
1082 ...
1083 }
1084 local data = cache
1085 for i = 1, #keys - 1 do
1086 if not data[keys[i]] then
1087 data[keys[i]] = {}
1088 end
1089 data = data[keys[i]]
1090 end
1091 data[keys[#keys]] = value
1092 end)
1093 network:add("updateinventorydata", function(data)
1094 cache.settings.inventorydata = data
1095 menu.updateinventorydata(cache.settings.inventorydata)
1096 end)
1097 network:add("updatepitydata", function(data)
1098 cache.settings.pitydata = data
1099 end)
1100 network:add("updateunlocksdata", function(data)
1101 cache.unlocks = data
1102 end)
1103 network:add("updateexperience", function(experience)
1104 cache.stats.experience = experience
1105 end)
1106 network:add("updatetotalkills", function(kills)
1107 cache.stats.totalkills = kills
1108 end)
1109 network:add("updatetotaldeaths", function(deaths)
1110 cache.stats.totaldeaths = deaths
1111 end)
1112 network:add("updategunkills", function(weapon, kills)
1113 local gundata = cache.unlocks[weapon]
1114 if not gundata then
1115 gundata = {}
1116 cache.unlocks[weapon] = gundata
1117 end
1118 gundata.kills = kills
1119 end)
1120 network:add("purchasegunconfirm", function(weapon)
1121 local gundata = cache.unlocks[weapon]
1122 if not gundata then
1123 gundata = {}
1124 cache.unlocks[weapon] = gundata
1125 end
1126 gundata.paid = true
1127 end)
1128 network:add("purchaseattachment", function(weapon, attachname)
1129 local gundata = cache.unlocks[weapon]
1130 if not gundata then
1131 gundata = {}
1132 cache.unlocks[weapon] = gundata
1133 end
1134 gundata[attachname] = true
1135 menu:updateattachpurchase(weapon, attachname)
1136 end)
1137 network:add("updatemoney", function(money)
1138 cache.stats.money = money
1139 menu:updatemoney(money)
1140 end)
1141 function playerdata.updateplayerdata(value, ...)
1142 local keys = {
1143 ...
1144 }
1145 local data = cache
1146 for i = 1, #keys - 1 do
1147 if not data[keys[i]] then
1148 data[keys[i]] = {}
1149 end
1150 data = data[keys[i]]
1151 end
1152 data[keys[#keys]] = value
1153 network:send("u" .. "p" .. "d" .. "a" .. "t" .. "e" .. "p" .. "l" .. "a" .. "y" .. "e" .. "r" .. "d" .. "a" .. "t" .. "a", value, ...)
1154 end
1155 function playerdata.getdata()
1156 return cache
1157 end
1158 network:send("l" .. "o" .. "a" .. "d" .. "p" .. "l" .. "a" .. "y" .. "e" .. "r" .. "d" .. "a" .. "t" .. "a")
1159end
1160print("Loading trash module")
1161do
1162 local destroy = game.Destroy
1163 local shit = {}
1164 function trash.remove(x)
1165 if x then
1166 shit[#shit + 1] = x
1167 x.Parent = nil
1168 end
1169 end
1170 function trash.empty()
1171 print("taking out " .. #shit .. " trash")
1172 for i = 1, #shit do
1173 destroy(shit[i])
1174 end
1175 shit = {}
1176 end
1177 network:add("emptytrash", trash.empty)
1178end
1179print("Loading utility module")
1180do
1181 local getchildren = game.GetChildren
1182 local rtype = game.IsA
1183 local joints = game.JointsService
1184 local tos = CFrame.new().toObjectSpace
1185 local tick = tick
1186 local new = Instance.new
1187 local waitforchild = game.WaitForChild
1188 local ffc = game.FindFirstChild
1189 local cf = CFrame.new
1190 local v3 = Vector3.new
1191 function utility.arraytohash(table, hashfunc)
1192 local newtable = {}
1193 for i = 1, #table do
1194 newtable[hashfunc(table[i])] = table[i]
1195 end
1196 return newtable
1197 end
1198 function utility.waitfor(object, timeout, ...)
1199 local indices = {
1200 ...
1201 }
1202 local index = object
1203 local quit = tick() + (timeout or 10)
1204 for i = 1, #indices do
1205 if index.WaitForChild then
1206 index = waitforchild(index, indices[i])
1207 else
1208 local newindex
1209 repeat
1210 run.wait()
1211 newindex = index[indices[i]]
1212 until newindex or quit < tick()
1213 index = newindex
1214 end
1215 if quit < tick() then
1216 return
1217 end
1218 end
1219 return index
1220 end
1221 function utility.getdescendants(object, type)
1222 type = type or "Instance"
1223 local descendants = getchildren(object)
1224 local i = 0
1225 while i < #descendants do
1226 i = i + 1
1227 local children = getchildren(descendants[i])
1228 for j = 1, #children do
1229 descendants[#descendants + 1] = children[j]
1230 end
1231 end
1232 local newdescendants = {}
1233 for i = 1, #descendants do
1234 if rtype(descendants[i], type) then
1235 newdescendants[#newdescendants + 1] = descendants[i]
1236 end
1237 end
1238 return newdescendants
1239 end
1240 function utility.weld(part0, part1, c0)
1241 c0 = c0 or tos(part0.CFrame, part1.CFrame)
1242 local newweld = new("Motor6D", part0)
1243 newweld.Part0 = part0
1244 newweld.Part1 = part1
1245 newweld.C0 = c0
1246 part0.Anchored = false
1247 part1.Anchored = false
1248 return newweld
1249 end
1250 function utility.removevalue(array, removals)
1251 local removelist = {}
1252 for i = 1, #removals do
1253 removelist[removals[i]] = true
1254 end
1255 local j = 1
1256 for i = 1, #array do
1257 local v = array[i]
1258 array[i] = nil
1259 if not removelist[v] then
1260 array[j] = v
1261 j = j + 1
1262 end
1263 end
1264 return array
1265 end
1266 function utility.drawray(newray, prop)
1267 local part = new("Part")
1268 part.Material = prop.material or Enum.Material.Neon
1269 part.Size = v3(prop.thickness or 0.1, prop.thickness or 0.1, newray.Direction.magnitude)
1270 part.CFrame = cf(newray.Origin + newray.Direction / 2, newray.Origin + newray.Direction)
1271 part.Anchored = true
1272 part.CanCollide = false
1273 part.BrickColor = prop.brickcolor or BrickColor.new("Bright red")
1274 part.Parent = prop.parent or workspace.Ignore
1275 game.Debris:AddItem(part, prop.life or 5)
1276 end
1277end
1278print("Loading event module")
1279do
1280 local resume = coroutine.resume
1281 local create = coroutine.create
1282 local pcall = pcall
1283 function event.new(eventtable)
1284 local self = eventtable or {}
1285 local funcs = {}
1286 local removelist = {}
1287 function self:connect(func)
1288 funcs[#funcs + 1] = func
1289 local removed = false
1290 local function remove()
1291 if not removed then
1292 removed = true
1293 removelist[func] = true
1294 end
1295 end
1296 return remove
1297 end
1298 local function fire(...)
1299 local n = #funcs
1300 local j = 0
1301 for i = 1, n do
1302 local func = funcs[i]
1303 if removelist[func] then
1304 removelist[func] = nil
1305 else
1306 j = j + 1
1307 funcs[j] = func
1308 end
1309 end
1310 for i = j + 1, n do
1311 funcs[i] = nil
1312 end
1313 for i = 1, j do
1314 resume(create(function(...)
1315 pcall(funcs[i], ...)
1316 end), ...)
1317 end
1318 end
1319 return fire, self
1320 end
1321end
1322print("Loading sequencer module")
1323do
1324 local tick = tick
1325 local type = type
1326 local remove = table.remove
1327 function sequencer.new()
1328 local self = {}
1329 local t0
1330 local sequence = {}
1331 local n = 0
1332 local deletions = 0
1333 function self:add(func, dur)
1334 n = n + 1
1335 if n == 1 then
1336 t0 = tick()
1337 end
1338 sequence[n] = {func = func, dur = dur}
1339 end
1340 function self:delay(dur)
1341 n = n + 1
1342 if n == 1 then
1343 t0 = tick()
1344 end
1345 sequence[n] = {dur = dur}
1346 end
1347 function self:clear()
1348 for i = 1, n do
1349 sequence[i] = nil
1350 end
1351 deletions = 0
1352 n = 0
1353 end
1354 function self:step()
1355 local time = tick()
1356 if deletions ~= 0 then
1357 for i = deletions + 1, n do
1358 sequence[i - deletions] = sequence[i]
1359 end
1360 for i = n - deletions + 1, n do
1361 sequence[i] = nil
1362 end
1363 n = n - deletions
1364 deletions = 0
1365 end
1366 for i = 1, n do
1367 local t = time - t0
1368 local func = sequence[i]
1369 local dur = func.dur
1370 local stop = false
1371 if func.func then
1372 stop = func.func(t)
1373 end
1374 if stop or stop == nil or dur and t > dur then
1375 t0 = time
1376 deletions = deletions + 1
1377 else
1378 break
1379 end
1380 end
1381 end
1382 return self
1383 end
1384end
1385print("Loading physics module")
1386do
1387 local sort = table.sort
1388 local atan2 = math.atan2
1389 local inf = math.huge
1390 local cos = math.cos
1391 local sin = math.sin
1392 local setmetatable = setmetatable
1393 local tick = tick
1394 local dot = Vector3.new().Dot
1395 physics.spring = {}
1396 do
1397 local spring = {}
1398 physics.spring = spring
1399 local tick = tick
1400 local setmt = setmetatable
1401 local cos = math.cos
1402 local sin = math.sin
1403 local e = 2.718281828459045
1404 function spring.new(init)
1405 local null = 0 * (init or 0)
1406 local d = 1
1407 local s = 1
1408 local p0 = init or null
1409 local v0 = null
1410 local p1 = init or null
1411 local t0 = tick()
1412 local h = 0
1413 local c1 = null
1414 local c2 = null
1415 local self = {}
1416 local meta = {}
1417 local function updateconstants()
1418 if s == 0 then
1419 h = 0
1420 c1 = null
1421 c2 = null
1422 elseif d < 0.99999999 then
1423 h = (1 - d * d) ^ 0.5
1424 c1 = p0 - p1
1425 c2 = d / h * c1 + v0 / (h * s)
1426 elseif d < 1.00000001 then
1427 h = 0
1428 c1 = p0 - p1
1429 c2 = c1 + v0 / s
1430 else
1431 h = (d * d - 1) ^ 0.5
1432 local a = -v0 / (2 * s * h)
1433 local b = -(p1 - p0) / 2
1434 c1 = (1 - d / h) * b + a
1435 c2 = (1 + d / h) * b - a
1436 end
1437 end
1438 local function pos(x)
1439 if x < 0.001 then
1440 return p0
1441 end
1442 if s == 0 then
1443 return p0
1444 elseif d < 0.99999999 then
1445 local co = cos(h * s * x)
1446 local si = sin(h * s * x)
1447 local ex = e ^ (d * s * x)
1448 return co / ex * c1 + si / ex * c2 + p1
1449 elseif d < 1.00000001 then
1450 local ex = e ^ (s * x)
1451 return (c1 + s * x * c2) / ex + p1
1452 else
1453 local co = e ^ ((-d - h) * s * x)
1454 local si = e ^ ((-d + h) * s * x)
1455 return c1 * co + c2 * si + p1
1456 end
1457 end
1458 local function vel(x)
1459 if x < 0.001 then
1460 return v0
1461 end
1462 if s == 0 then
1463 return p0
1464 elseif d < 0.99999999 then
1465 local co = cos(h * s * x)
1466 local si = sin(h * s * x)
1467 local ex = e ^ (d * s * x)
1468 return s * (co * h - d * si) / ex * c2 - s * (co * d + h * si) / ex * c1
1469 elseif d < 1.00000001 then
1470 local ex = e ^ (s * x)
1471 return -s / ex * (c1 + (s * x - 1) * c2)
1472 else
1473 local co = e ^ ((-d - h) * s * x)
1474 local si = e ^ ((-d + h) * s * x)
1475 return si * (h - d) * s * c2 - co * (d + h) * s * c1
1476 end
1477 end
1478 local function posvel(x)
1479 if s == 0 then
1480 return p0
1481 elseif d < 0.99999999 then
1482 local co = cos(h * s * x)
1483 local si = sin(h * s * x)
1484 local ex = e ^ (d * s * x)
1485 return co / ex * c1 + si / ex * c2 + p1, s * (co * h - d * si) / ex * c2 - s * (co * d + h * si) / ex * c1
1486 elseif d < 1.00000001 then
1487 local ex = e ^ (s * x)
1488 return (c1 + s * x * c2) / ex + p1, -s / ex * (c1 + (s * x - 1) * c2)
1489 else
1490 local co = e ^ ((-d - h) * s * x)
1491 local si = e ^ ((-d + h) * s * x)
1492 return c1 * co + c2 * si + p1, si * (h - d) * s * c2 - co * (d + h) * s * c1
1493 end
1494 end
1495 updateconstants()
1496 function self.getpv()
1497 return posvel(tick() - t0)
1498 end
1499 function self.setpv(p, v)
1500 local time = tick()
1501 p0, v0 = p, v
1502 t0 = time
1503 updateconstants()
1504 end
1505 function self:accelerate(a)
1506 local time = tick()
1507 local p, v = posvel(time - t0)
1508 p0, v0 = p, v + a
1509 t0 = time
1510 updateconstants()
1511 end
1512 function meta:__index(index)
1513 local time = tick()
1514 if index == "p" then
1515 return pos(time - t0)
1516 elseif index == "v" then
1517 return vel(time - t0)
1518 elseif index == "t" then
1519 return p1
1520 elseif index == "d" then
1521 return d
1522 elseif index == "s" then
1523 return s
1524 end
1525 end
1526 function meta:__newindex(index, value)
1527 local time = tick()
1528 if index == "p" then
1529 p0, v0 = value, vel(time - t0)
1530 elseif index == "v" then
1531 p0, v0 = pos(time - t0), value
1532 elseif index == "t" then
1533 p0, v0 = posvel(time - t0)
1534 p1 = value
1535 elseif index == "d" then
1536 p0, v0 = posvel(time - t0)
1537 d = value
1538 elseif index == "s" then
1539 p0, v0 = posvel(time - t0)
1540 s = value
1541 elseif index == "a" then
1542 local p, v = posvel(time - t0)
1543 p0, v0 = p, v + value
1544 end
1545 t0 = time
1546 updateconstants()
1547 end
1548 return setmt(self, meta)
1549 end
1550 end
1551 local err = 1.0E-10
1552 local function solve(a, b, c, d, e)
1553 if not a then
1554 return
1555 elseif a > -err and a < err then
1556 return solve(b, c, d, e)
1557 end
1558 if e then
1559 local k = -b / (4 * a)
1560 local p = (8 * a * c - 3 * b * b) / (8 * a * a)
1561 local q = (b * b * b + 8 * a * a * d - 4 * a * b * c) / (8 * a * a * a)
1562 local r = (16 * a * a * b * b * c + 256 * a * a * a * a * e - 3 * a * b * b * b * b - 64 * a * a * a * b * d) / (256 * a * a * a * a * a)
1563 local h0, h1, h2 = solve(1, 2 * p, p * p - 4 * r, -q * q)
1564 local s = h2 or h0
1565 if s < err then
1566 local f0, f1 = solve(1, p, r)
1567 if not f1 or f1 < 0 then
1568 return
1569 else
1570 local f = f1 ^ 0.5
1571 return k - f, k + f
1572 end
1573 else
1574 local h = s ^ 0.5
1575 local f = (h * h * h + h * p - q) / (2 * h)
1576 if f > -err and f < err then
1577 return k - h, k
1578 else
1579 local r0, r1 = solve(1, h, f)
1580 local r2, r3 = solve(1, -h, r / f)
1581 if r0 and r2 then
1582 return k + r0, k + r1, k + r2, k + r3
1583 elseif r0 then
1584 return k + r0, k + r1
1585 elseif r2 then
1586 return k + r2, k + r3
1587 else
1588 return
1589 end
1590 end
1591 end
1592 elseif d then
1593 local k = -b / (3 * a)
1594 local p = (3 * a * c - b * b) / (9 * a * a)
1595 local q = (2 * b * b * b - 9 * a * b * c + 27 * a * a * d) / (54 * a * a * a)
1596 local r = p * p * p + q * q
1597 local s = r ^ 0.5 + q
1598 if s > -err and s < err then
1599 if q < 0 then
1600 return k + (-2 * q) ^ 0.3333333333333333
1601 else
1602 return k - (2 * q) ^ 0.3333333333333333
1603 end
1604 elseif r < 0 then
1605 local m = (-p) ^ 0.5
1606 local d = atan2((-r) ^ 0.5, q) / 3
1607 local u = m * cos(d)
1608 local v = m * sin(d)
1609 return k - 2 * u, k + u - 1.7320508075688772 * v, k + u + 1.7320508075688772 * v
1610 elseif s < 0 then
1611 local m = -(-s) ^ 0.3333333333333333
1612 return k + p / m - m
1613 else
1614 local m = s ^ 0.3333333333333333
1615 return k + p / m - m
1616 end
1617 elseif c then
1618 local k = -b / (2 * a)
1619 local u2 = k * k - c / a
1620 if u2 < 0 then
1621 return
1622 else
1623 local u = u2 ^ 0.5
1624 return k - u, k + u
1625 end
1626 elseif b then
1627 return -b / a
1628 else
1629 return
1630 end
1631 end
1632 physics.solve = solve
1633 local minpos = function(a, b, c, d)
1634 if a and a >= 0 then
1635 return a
1636 elseif b and b >= 0 then
1637 return b
1638 elseif c and c >= 0 then
1639 return c
1640 elseif d and d >= 0 then
1641 return d
1642 end
1643 end
1644 physics.minpos = minpos
1645 local function minposroot(a, b, c, d, e)
1646 return minpos(solve(a, b, c, d, e))
1647 end
1648 physics.minposroot = minposroot
1649 function physics.cpoint_traj_point(v, a, r)
1650 local a0 = -2 * dot(r, v)
1651 local a1 = 2 * (dot(v, v) - dot(a, r))
1652 local a2 = 3 * dot(a, v)
1653 local a3 = dot(a, a)
1654 local t = minpos(solve(a3, a2, a1, a0))
1655 if t then
1656 return t, t * v + t * t / 2 * a
1657 end
1658 end
1659 function physics.simple_trajectory(s, a, r)
1660 local a0 = 4 * dot(r, r)
1661 local a1 = -4 * (dot(a, r) + s * s)
1662 local a2 = dot(a, a)
1663 local u = minpos(solve(a2, a1, a0))
1664 if u then
1665 local t = u ^ 0.5
1666 return r / t - t / 2 * a
1667 end
1668 end
1669 function physics.trajectory(pp, pv, pa, tp, tv, ta, s)
1670 local rp = tp - pp
1671 local rv = tv - pv
1672 local ra = ta - pa
1673 local t0, t1, t2, t3 = solve(dot(ra, ra) / 4, dot(ra, rv), dot(ra, rp) + dot(rv, rv) - s * s, 2 * dot(rp, rv), dot(rp, rp))
1674 if t0 and t0 > 0 then
1675 return ra * t0 / 2 + tv + rp / t0, t0
1676 elseif t1 and t1 > 0 then
1677 return ra * t1 / 2 + tv + rp / t1, t1
1678 elseif t2 and t2 > 0 then
1679 return ra * t2 / 2 + tv + rp / t2, t2
1680 elseif t3 and t3 > 0 then
1681 return ra * t3 / 2 + tv + rp / t3, t3
1682 end
1683 end
1684end
1685print("Loading particle module")
1686do
1687 local setmt = setmetatable
1688 local remove = table.remove
1689 local airdensity = 0.001225
1690 local ln = math.log
1691 local tan = math.tan
1692 local atan2 = math.atan2
1693 local deg = math.pi / 180
1694 local tick = tick
1695 local playergui = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
1696 local camera = game.Workspace.CurrentCamera
1697 local workspace = game.Workspace
1698 local components = CFrame.new().components
1699 local v3 = Vector3.new
1700 local dot = v3().Dot
1701 local ray = Ray.new
1702 local raycast = workspace.FindPartOnRayWithIgnoreList
1703 local raycastwl = workspace.FindPartOnRayWithWhitelist
1704 local c3 = Color3.new
1705 local ud2 = UDim2.new
1706 local new = Instance.new
1707 local ffc = game.FindFirstChild
1708 local players = game:GetService("Players")
1709 local frames = {}
1710 local bullets = {}
1711 local rendignore = {}
1712 local particles = {}
1713 local removelist = {}
1714 local screen = ffc(playergui, "ScreenGui") or new("ScreenGui", playergui)
1715 local time = tick()
1716 local planey, planex, pixelcoef
1717 local cameraposition = camera.CoordinateFrame.p
1718 local cpx, cpy, cpz, cxx, cxy, cxz, cyx, cyy, cyz, czx, czy, czz = components(camera.CoordinateFrame)
1719 function particle.new(prop)
1720 local self = {}
1721 local px, py, pz = 0, 0, 0
1722 local vx, vy, vz = 0, 0, 0
1723 local ax, ay, az = 0, 0, 0
1724 local lx, ly, lz
1725 local culling = prop.culling == nil or prop.culling
1726 local size = prop.size or 1
1727 local bloom = prop.bloom or 0
1728 local brightness = prop.brightness or 1
1729 local style = prop.style or "round"
1730 local maxrange = prop.maxrange or 1000
1731 local cancollide = prop.cancollide == nil or prop.cancollide
1732 local resistance = prop.resistance or 1
1733 local elasticity = prop.elasticity or 0.3
1734 local physicsonly = prop.physicsonly or false
1735 local minexitvelocity = prop.minexitvelocity or 500
1736 local penetrationdepth = prop.penetrationdepth or leleltru and 1000000 or 0.5
1737 local penetrationpower = penetrationdepth
1738 local life = tick() + (prop.life or 10)
1739 local physignore = prop.physicsignore or {
1740 workspace.Ignore,
1741 camera,
1742 char.character
1743 }
1744 local rendignore = prop.renderignore or rendignore
1745 local onstep = prop.onstep
1746 local ontouch = prop.ontouch
1747 local wasrendered = false
1748 local wasobstructed
1749 local distance = 0
1750 local frame
1751 if #frames ~= 0 then
1752 frame = frames[#frames]
1753 frames[#frames] = nil
1754 else
1755 frame = new("ImageLabel", screen)
1756 frame.BorderSizePixel = 0
1757 end
1758 if style == "box" then
1759 frame.BackgroundColor3 = prop.color or c3(1, 1, 1)
1760 frame.BackgroundTransparency = 0
1761 frame.Image = nil
1762 else
1763 frame.ImageColor3 = prop.color or c3(1, 1, 1)
1764 frame.BackgroundTransparency = 1
1765 frame.Image = "rbxassetid://553151967"
1766 if style == "round" then
1767 frame.ScaleType = "Slice"
1768 frame.SliceCenter = Rect.new(512, 512, 512, 512)
1769 elseif style == "oval" then
1770 frame.ScaleType = "Stretch"
1771 end
1772 end
1773 self.frame = frame
1774 if prop.position then
1775 local pos = prop.position
1776 px, py, pz = pos.x, pos.y, pos.z
1777 end
1778 if prop.velocity then
1779 local vel = prop.velocity
1780 vx, vy, vz = vel.x, vel.y, vel.z
1781 end
1782 if prop.acceleration then
1783 local acc = prop.acceleration
1784 ax, ay, az = acc.x, acc.y, acc.z
1785 end
1786 lx = (px - cpx) * cxx + (py - cpy) * cxy + (py - cpz) * cxz
1787 ly = (px - cpx) * cyx + (py - cpy) * cyy + (py - cpz) * cyz
1788 lz = -((px - cpx) * czx + (py - cpy) * czy + (py - cpz) * czz)
1789 wasobstructed = true
1790 function self:remove()
1791 removelist[self] = true
1792 end
1793 local part
1794 do
1795 local bullet
1796 if effects.disabletreyparticles then
1797 if #bullets ~= 0 then
1798 bullet = bullets[#bullets]
1799 bullets[#bullets] = nil
1800 else
1801 bullet = game.ReplicatedStorage.Effects.Bullet:Clone()
1802 bullet.Parent = workspace.Ignore.Bullets
1803 end
1804 bullet.Trail.Color = ColorSequence.new(prop.color or c3(1, 1, 1))
1805 bullet.Board.Dot.ImageColor3 = prop.color or c3(1, 1, 1)
1806 bullet.Board.Enabled = true
1807 bullet.Trail.Enabled = true
1808 self.bullet = bullet
1809 else
1810 self.bullet = false
1811 end
1812 end
1813 function self.step(dt, time)
1814 if life and time > life then
1815 removelist[self] = true
1816 return
1817 end
1818 do
1819 local qx, qy, qz = px, py, pz
1820 local ix, iy, iz = vx, vy, vz
1821 local v = (vx * vx + vy * vy + vz * vz) ^ 0.5
1822 vx, vy, vz = vx + dt * ax, vy + dt * ay, vz + dt * az
1823 local dx, dy, dz = dt / 2 * (ix + vx), dt / 2 * (iy + vy), dt / 2 * (iz + vz)
1824 if cancollide then
1825 local direction = v3(dx, dy, dz)
1826 local hit, pos, norm = raycast(workspace, ray(v3(px, py, pz), direction), physignore)
1827 if hit then
1828 local unit = direction.unit
1829 local dir = hit.Size.magnitude * unit
1830 local nextpos = pos + dir
1831 local _, exit, exitnorm = raycastwl(workspace, ray(nextpos, -dir), {hit})
1832 local diff = exit - pos
1833 local dist = diff.magnitude
1834 local pass = not hit.CanCollide
1835 local human = replication.getcharhitinfo(hit, pos, dir)
1836 local penetrationratio
1837 if penetrationpower == 0 then
1838 penetrationratio = 1
1839 else
1840 penetrationratio = penetrationdepth / penetrationpower
1841 end
1842 if dist > 0 then
1843 if pass then
1844 px, py, pz = exit.x, exit.y, exit.z
1845 elseif dist < penetrationdepth then
1846 local newexit = pos + 0.01 * unit
1847 px, py, pz = newexit.x, newexit.y, newexit.z
1848 local rx, ry, rz = px - qx, py - qy, pz - qz
1849 distance = distance + (pos - v3(qx, qy, qz)).magnitude
1850 local gv = 2.7182818459045 ^ (-resistance * dist)
1851 vx, vy, vz = gv * vx, gv * vy, gv * vz
1852 penetrationdepth = human and penetrationdepth or penetrationdepth - dist
1853 else
1854 removelist[self] = true
1855 px, py, pz = pos.x, pos.y, pos.z
1856 end
1857 else
1858 if not pass then
1859 removelist[self] = true
1860 end
1861 px, py, pz = nextpos.x, nextpos.y, nextpos.z
1862 local gv = 2.7182818459045 ^ (-resistance * dot(unit, nextpos - pos))
1863 vx, vy, vz = gv * vx, gv * vy, gv * vz
1864 end
1865 if ontouch then
1866 ontouch(part, human and human.object or hit, pos, norm, penetrationratio, human and human.player)
1867 end
1868 physignore[#physignore + 1] = human and human.character or hit
1869 else
1870 px, py, pz = px + dx, py + dy, pz + dz
1871 end
1872 else
1873 local rx, ry, rz = px - qx, py - qy, pz - qz
1874 distance = distance + (rx * rx + ry * ry + rz * rz) ^ 0.5
1875 px, py, pz = px + dx, py + dy, pz + dz
1876 end
1877 local rx, ry, rz = px - qx, py - qy, pz - qz
1878 distance = distance + (rx * rx + ry * ry + rz * rz) ^ 0.5
1879 if self.bullet then
1880 self.bullet.CFrame = CFrame.new(px, py, pz)
1881 end
1882 end
1883 if onstep then
1884 onstep(part, dt)
1885 end
1886 if prop.physicsonly then
1887 return "physics only"
1888 end
1889 if not self.bullet then
1890 local rx, ry, rz = px - cpx, py - cpy, pz - cpz
1891 local dx = rx * cxx + ry * cxy + rz * cxz
1892 local dy = rx * cyx + ry * cyy + rz * cyz
1893 local dz = -(rx * czx + ry * czy + rz * czz)
1894 if brightness == 0 or dz < 1 and lz < 1 then
1895 if wasrendered then
1896 wasrendered = false
1897 frame.BackgroundTransparency = 1
1898 frame.ImageTransparency = 1
1899 end
1900 lx, ly, lz = dx, dy, dz
1901 wasobstructed = false
1902 return "behind or tansparent"
1903 end
1904 local obstructed
1905 if maxrange * maxrange < dx * dx + dy * dy + dz * dz then
1906 obstructed = true
1907 elseif culling then
1908 obstructed = raycast(workspace, ray(cameraposition, v3(px, py, pz) - cameraposition), rendignore)
1909 end
1910 if obstructed or wasobstructed then
1911 if wasrendered then
1912 wasrendered = false
1913 frame.BackgroundTransparency = 1
1914 frame.ImageTransparency = 1
1915 end
1916 lx, ly, lz = dx, dy, dz
1917 wasobstructed = obstructed
1918 return "obstructed"
1919 end
1920 local rx, ry, rdepth, sx, sy, sdepth
1921 if dz > 1 and lz > 1 then
1922 rx, ry, rdepth = lx / lz, ly / lz, lz
1923 sx, sy, sdepth = dx / dz, dy / dz, dz
1924 elseif dz < 1 then
1925 local d = (1 - dz) / (lz - dz)
1926 rx, ry, rdepth = lx / lz, ly / lz, lz
1927 sx, sy, sdepth = d * (lx - dx) + dx, d * (ly - dy) + dy, 1
1928 else
1929 local d = (1 - lz) / (dz - lz)
1930 rx, ry, rdepth = d * (dx - lx) + lx, d * (dy - ly) + ly, 1
1931 sx, sy, sdepth = dx / dz, dy / dz, dz
1932 end
1933 if rx < -planex and sx < -planex or rx > planex and sx > planex or ry < -planey and sy < -planey or ry > planey and sy > planey then
1934 if wasrendered then
1935 wasrendered = false
1936 frame.BackgroundTransparency = 1
1937 frame.ImageTransparency = 1
1938 end
1939 lx, ly, lz = dx, dy, dz
1940 wasobstructed = obstructed
1941 return "off screen"
1942 end
1943 local slope = (sy - ry) / (sx - rx)
1944 local hx, hy, hz = dx - lx, dy - ly, dz - lz
1945 if rx < -planex and sx > -planex then
1946 rx, ry = -planex, sy - slope * (planex + sx)
1947 rdepth = lz - (lz * planex + lx) / (hz * planex + hx) * hz
1948 elseif rx > -planex and sx < -planex then
1949 sx, sy = -planex, ry - slope * (planex + rx)
1950 sdepth = lz - (lz * planex + lx) / (hz * planex + hx) * hz
1951 end
1952 if rx < planex and sx > planex then
1953 sx, sy = planex, ry + slope * (planex - rx)
1954 sdepth = lz - (lz * planex - lx) / (hz * planex - hx) * hz
1955 elseif rx > planex and sx < planex then
1956 rx, ry = planex, sy + slope * (planex - sx)
1957 rdepth = lz - (lz * planex - lx) / (hz * planex - hx) * hz
1958 end
1959 if ry < -planey and sy > -planey then
1960 ry, rx = -planey, sx - (planey + sy) / slope
1961 rdepth = lz - (lz * planey + ly) / (hz * planey + hy) * hz
1962 elseif ry > -planey and sy < -planey then
1963 sy, sx = -planey, rx - (planey + ry) / slope
1964 sdepth = lz - (lz * planey + ly) / (hz * planey + hy) * hz
1965 end
1966 if ry < planey and sy > planey then
1967 sy, sx = planey, rx + (planey - ry) / slope
1968 sdepth = lz - (lz * planey - ly) / (hz * planey - hy) * hz
1969 elseif ry > planey and sy < planey then
1970 ry, rx = planey, sx + (planey - sy) / slope
1971 rdepth = lz - (lz * planey - ly) / (hz * planey - hy) * hz
1972 end
1973 local ux, uy = pixelcoef * (rx + planex), pixelcoef * (planey - ry) - 36
1974 local vx, vy = pixelcoef * (sx + planex), pixelcoef * (planey - sy) - 36
1975 local wx, wy = vx - ux, vy - uy
1976 local s = pixelcoef * size / (rdepth * sdepth) ^ 0.5
1977 local area = s * s
1978 local b = pixelcoef * bloom + s
1979 local sx, sy = (wx * wx + wy * wy) ^ 0.5 + b, b
1980 local transparency = 1 - brightness * area / (sx * sy)
1981 frame.Size = ud2(0, sx, 0, sy)
1982 frame.Position = ud2(0, (ux + vx - sx) / 2, 0, (uy + vy - s) / 2)
1983 if prop.style == "box" then
1984 frame.BackgroundTransparency = transparency
1985 else
1986 frame.ImageTransparency = transparency
1987 end
1988 if wx ~= 0 then
1989 frame.Rotation = atan2(wy, wx) / deg
1990 end
1991 lx, ly, lz = dx, dy, dz
1992 wasrendered = true
1993 wasobstructed = obstructed
1994 return "rendered"
1995 end
1996 end
1997 particles[#particles + 1] = self
1998 local get = {}
1999 local set = {}
2000 local meta = {}
2001 function meta.__index(table, index)
2002 return get[index]()
2003 end
2004 function meta.__newindex(table, index, value)
2005 return set[index](value)
2006 end
2007 function get.position()
2008 return v3(px, py, pz)
2009 end
2010 function get.velocity()
2011 return v3(vx, vy, vz)
2012 end
2013 function get.acceleration()
2014 return v3(ax, ay, az)
2015 end
2016 function get.cancollide()
2017 return cancollide
2018 end
2019 function get.size()
2020 return size
2021 end
2022 function get.bloom()
2023 return bloom
2024 end
2025 function get.brightness()
2026 return brightness
2027 end
2028 function get.color()
2029 return frame.BackgroundColor3
2030 end
2031 function get.life()
2032 return life - tick()
2033 end
2034 function get.distance()
2035 return distance
2036 end
2037 function set.position(p)
2038 px, py, pz = p.x, p.y, p.z
2039 end
2040 function set.velocity(v)
2041 vx, vy, vz = v.x, v.y, v.z
2042 end
2043 function set.acceleration(a)
2044 ax, ay, az = a.x, a.y, a.z
2045 end
2046 function set.cancollide(newcancollide)
2047 cancollide = newcancollide
2048 end
2049 function set.size(newsize)
2050 size = newsize
2051 end
2052 function set.bloom(newbloom)
2053 bloom = newbloom
2054 end
2055 function set.brightness(newbrightness)
2056 brightness = newbrightness
2057 end
2058 function set.color(newcolor)
2059 frame.BackgroundColor3 = newcolor
2060 end
2061 function set.life(newlife)
2062 life = tick() + newlife
2063 end
2064 part = setmt(self, meta)
2065 if prop.dt then
2066 self.step(prop.dt, tick())
2067 end
2068 return part
2069 end
2070 local avg = 800
2071 local asd = 0
2072 function particle.step(dt)
2073 local newtime = tick()
2074 local dt = newtime - time
2075 time = newtime
2076 local cameracf = camera.CoordinateFrame
2077 local screenx, screeny = camera.ViewportSize.x, camera.ViewportSize.y
2078 planey = tan(camera.FieldOfView / 2 * deg)
2079 planex = screenx / screeny * planey
2080 pixelcoef = screeny / (2 * planey)
2081 cameraposition = cameracf.p
2082 cpx, cpy, cpz, cxx, cyx, czx, cxy, cyy, czy, cxz, cyz, czz = components(cameracf)
2083 local j = 0
2084 for i = 1, #particles do
2085 local p = particles[i]
2086 particles[i] = nil
2087 if removelist[p] then
2088 p.frame.BackgroundTransparency = 1
2089 p.frame.ImageTransparency = 1
2090 frames[#frames + 1] = p.frame
2091 if p.bullet then
2092 p.bullet.Board.Enabled = false
2093 p.bullet.Trail.Enabled = false
2094 bullets[#bullets + 1] = p.bullet
2095 end
2096 removelist[p] = nil
2097 elseif p then
2098 p.step(dt, time)
2099 j = j + 1
2100 particles[j] = p
2101 end
2102 end
2103 if #particles > 0 then
2104 local d = #particles / 60 / (tick() - time)
2105 avg = avg * 0.95 + d * 0.05
2106 end
2107 if asd == 0 then
2108 end
2109 asd = (asd + 1) % 60
2110 end
2111 function particle:addtorenderignore(object)
2112 for i = 1, #rendignore do
2113 if rendignore[i] == object then
2114 return
2115 end
2116 end
2117 local init = #rendignore + 1
2118 rendignore[init] = object
2119 object.Changed:connect(function(prop)
2120 if prop == "Parent" and not object.Parent then
2121 for i = init, 1, -1 do
2122 if rendignore[i] == object then
2123 remove(rendignore, i)
2124 break
2125 end
2126 end
2127 end
2128 end)
2129 end
2130 function particle:reset()
2131 screen:ClearAllChildren()
2132 workspace.Ignore.Bullets:ClearAllChildren()
2133 bullets = {}
2134 frames = {}
2135 particles = {}
2136 end
2137 screen.AncestryChanged:connect(function()
2138 wait()
2139 screen.Parent = playergui
2140 end)
2141end
2142print("Loading sound module")
2143do
2144 local random = math.random
2145 local new = Instance.new
2146 local fonts = {}
2147 local free = {}
2148 function sound.load(name, ...)
2149 local font = {
2150 ...
2151 }
2152 for i = 1, #font do
2153 font[i] = "rbxassetid://" .. font[i]
2154 end
2155 fonts[name] = font
2156 end
2157 function sound.play(name, volume, pitch, parent, onDestroy, isLooped, destroySound)
2158 local font = fonts[name]
2159 if font then
2160 do
2161 local soundobject
2162 if #free == 0 then
2163 soundobject = new("Sound", workspace)
2164 soundobject.Ended:connect(function()
2165 free[#free + 1] = soundobject
2166 soundobject.Parent = workspace
2167 end)
2168 else
2169 soundobject = free[#free]
2170 free[#free] = nil
2171 end
2172 soundobject.Parent = parent or workspace
2173 soundobject.SoundId = font[random(1, #font)]
2174 soundobject.Volume = volume or 1
2175 soundobject.Pitch = pitch or 1
2176 soundobject.Looped = isLooped
2177 if onDestroy then
2178 soundobject.PlayOnRemove = true
2179 else
2180 soundobject:Play()
2181 end
2182 end
2183 end
2184 end
2185 sound.load("equipCloth", 873041870, 873041900, 873041920, 873041944, 873041967, 873041996)
2186 sound.load("equipGear", 873042033, 873042054, 873042146, 873042186, 873042220, 873042247)
2187 sound.load("smallSharp", 1073249423, 1073249467, 1073249515)
2188 sound.load("smallSharpEquip", 1073252883, 1073252922)
2189 sound.load("bigSharp", 1073259492, 1073259546)
2190 sound.load("bigSharpEquip", 1073259576)
2191 sound.load("saber", 1073290506, 1073290552, 1073290611)
2192 sound.load("saberEquip", 1073290296, 1073290384, 1073290458)
2193 sound.load("saberLoop", 1073293116)
2194 sound.load("smallBluntEquip", 1073355154)
2195 sound.load("bigBluntEquip", 1073355392)
2196 sound.load("bigBlunt", 1073356333, 1073356365, 1073356402)
2197 sound.load("smallBlunt", 1073356781)
2198 sound.load("aimCloth", 873073597, 873073657, 873073703, 873073749, 873073824, 873073853)
2199 sound.load("aimGear", 873073890, 873073947, 873073999, 873074053, 873074075, 873074102)
2200 sound.load("parkour", 873084310, 873084337, 873084366, 873084394, 873084419, 873084440)
2201 sound.load("stanceProne", 619647373, 619647453)
2202 sound.load("stanceStandCrouch", 619647649, 619649245, 619649367)
2203 sound.load("slideStart", 873104808, 873104834, 873104858, 873104886, 873104915, 873104940)
2204 sound.load("slideEnd", 873101789, 873101811, 873101828)
2205 sound.load("heartBeatIn", 635546179)
2206 sound.load("heartBeatOut", 635546243)
2207 sound.load("useScope", 635546067)
2208 sound.load("killshot", 898398768, 898398730, 898398743)
2209 sound.load("headshotkill", 898398768, 898398785, 898398795, 898398809, 898398817, 898398837)
2210 sound.load("crackSmall", 873119768, 873119788, 873119811, 873119845, 873119886, 873119904)
2211 sound.load("crackBig", 873119597, 873119653, 873119679, 873119703, 873119724, 873119744)
2212 sound.load("whizz", 873121840, 873121858, 873121876, 873121896, 873121913, 873121936)
2213 sound.load("1PsniperBass", 725750810, 725750891, 725750973)
2214 sound.load("1PsniperEcho", 725751043, 725751110, 725751178)
2215 sound.load("fragClose", 873196488, 873196525, 873196559, 873196591, 873196633, 873196678)
2216 sound.load("fragMed", 873196719, 873196759, 873196789, 873196821, 873196855, 873196883, 873196918, 873196944)
2217 sound.load("fragFar", 873196972, 873196997, 873197013, 873197044, 873197083, 873197117)
2218 sound.load("friendly_concreterun", 738449694, 738449739, 738449789, 738449845, 738449901, 738449961)
2219 sound.load("friendly_concretewalk", 738450012, 738450072, 738450121, 738450173, 738450221, 738450271)
2220 sound.load("friendly_concretescuff", 738476779, 738476835, 738476883, 738476924)
2221 sound.load("friendly_grassrun", 738484818, 738484890, 738484962, 738485221, 738485290, 738485364)
2222 sound.load("friendly_grasswalk", 738486870, 738486925, 738486971, 738487026, 738487059, 738487106)
2223 sound.load("friendly_grassscuff", 738488265, 738488385, 738488447, 738488512)
2224 sound.load("friendly_woodrun", 739361221, 739361264, 739361281, 739361317, 739361357, 739361379)
2225 sound.load("friendly_woodwalk", 739361404, 739361426, 739361445, 739361473, 739361503, 739361526)
2226 sound.load("friendly_woodscuff", 739361547, 739361572, 739361584, 739361608)
2227 sound.load("friendly_sandrun", 743048910, 743048927, 743048941, 743048953, 743048965, 743048979)
2228 sound.load("friendly_sandwalk", 743049002, 743049031, 743049053, 743049073, 743049085, 743049103)
2229 sound.load("friendly_sandscuff", 743049123, 743049139, 743049153, 743049162)
2230 sound.load("friendly_metalrun", 744281043, 744281081, 744281118, 744281156, 744281205, 744281233)
2231 sound.load("friendly_metalwalk", 744281257, 744281287, 744281319, 744281350, 744281374, 744281411)
2232 sound.load("friendly_metalscuff", 758169120, 758169193, 758169297, 758169399)
2233 sound.load("concreteLand", 623307723, 623307791, 623307897)
2234 sound.load("grassLand", 623322852, 623322902, 623322960)
2235 sound.load("sandLand", 623308020, 623322719, 623322784)
2236 sound.load("woodLand", 623329224, 623329303, 623329368)
2237 sound.load("metalLand", 866618834, 866618870, 866618897, 866618921)
2238 sound.load("landHard", 866638867)
2239 sound.load("landNearDeath", 866639973)
2240 sound.load("enemy_concreterun", 739281446, 739281465, 739281494, 739281525, 739281543, 739281565)
2241 sound.load("enemy_concretewalk", 739281325, 739281342, 739281360, 739281381, 739281395, 739281423)
2242 sound.load("enemy_woodrun", 739377453, 739377475, 739377503, 739377526, 739377546, 739377556)
2243 sound.load("enemy_woodwalk", 739377579, 739377595, 739377625, 739377652, 739377685, 739377713)
2244 sound.load("enemy_grassrun", 739805543, 739805588, 739805641, 739805681, 739805724, 739805762)
2245 sound.load("enemy_grasswalk", 739805800, 739805889, 739805996, 739806047, 739806110, 739806155)
2246 sound.load("enemy_sandrun", 744274870, 744274901, 744274936, 744274967, 744275010, 744275043)
2247 sound.load("enemy_sandwalk", 744275075, 744275099, 744275126, 744275156, 744275192, 744275220)
2248 sound.load("enemy_metalrun", 758173026, 758173133, 758173185, 758173250, 758173441, 758173516)
2249 sound.load("enemy_metalwalk", 758173608, 758173682, 758173759, 758173891, 758173986, 758174065)
2250 sound.load("movement_gearsmall", 677006227, 677006264, 677006302, 677006342, 677006383, 677007056, 677007096, 677007128)
2251 sound.load("movement_gearbig", 677010268, 677010313, 677010351, 677010399, 677010436, 677010482, 677010520, 677010549)
2252 sound.load("movement_clothrun", 724561895, 724561958, 724561997, 724562031)
2253 sound.load("movement_clothwalk", 724559173, 724559198, 724559218, 724559241)
2254 sound.load("movement_base", 676998794, 676998859, 676998915, 676998993, 676999050, 676999094, 676999145, 676999188, 676999245, 676999327, 676999356, 676999395)
2255 sound.load("imp_concrete", 871701076, 871701134, 871701190, 871701241, 871701297, 871701346)
2256 sound.load("imp_metal", 871704182, 871704259, 871704297, 871704329, 871704362, 871704395)
2257 sound.load("imp_wood", 871705143, 871705174, 871705195, 871705217, 871705237, 871705264)
2258 sound.load("imp_grass", 871709869, 871709832, 871709789, 871709755, 871709708, 871709643)
2259 sound.load("wizz", 342190005, 342190012, 342190017, 342190024)
2260 sound.load("snap", 342190488, 342190495, 342190504, 342190510)
2261 sound.load("woodhit", 342204157, 342204164, 342204170, 342204175)
2262 sound.load("stonehit", 342204189, 342204194, 342204197, 342204203)
2263 sound.load("metalhit", 342204233, 342204240, 342204244, 342204250)
2264 sound.load("woodstep", 169160364)
2265 sound.load("hardstep", 135923526, 342422087, 131436155)
2266 sound.load("softstep", 134456884)
2267 sound.load("fullmetalstep", 342421947, 342421958, 342421973, 342421997)
2268 sound.load("hollowmetalstep", 342421947, 342421958, 342421973, 342421997)
2269 sound.load("metalshell", 342423812, 342423826, 342423844, 342423860)
2270 sound.load("shotgunshell", 342423873, 342423885)
2271end
2272globalsound = sound
2273globalnetwork = network
2274globalreplication = replication
2275print("Loading effects module")
2276do
2277 local wfc = game.WaitForChild
2278 local ffc = game.FindFirstChild
2279 local ud2 = UDim2.new
2280 local v3 = Vector3.new
2281 local nv = v3()
2282 local cf = CFrame.new
2283 local angles = CFrame.Angles
2284 local deg = math.pi / 180
2285 local random = math.random
2286 local color = Color3.new
2287 local colorseq = ColorSequence.new
2288 local spawn = function(F)
2289 coroutine.resume(coroutine.create(F))
2290 end
2291 local ray = Ray.new
2292 local raycast = workspace.FindPartOnRayWithIgnoreList
2293 local debris = game.Debris
2294 local new = Instance.new
2295 local dot = nv.Dot
2296 local nc = cf()
2297 local vtws = nc.vectorToWorldSpace
2298 local player = game:GetService("Players").LocalPlayer
2299 local light = game.Lighting
2300 local pgui = player.PlayerGui
2301 local repeffects = game.ReplicatedStorage.Effects
2302 local smoke = repeffects.Smoke
2303 local hole = repeffects.Hole
2304 local flash = repeffects.Muzzle
2305 local shell = repeffects.Shell
2306 local blood = repeffects.Blood
2307 local bloodsplat = repeffects.BloodSplat
2308 local ignore = workspace.Ignore
2309 local mapbloom = wfc(light, "MapBloom")
2310 local mapray = wfc(light, "MapRay")
2311 local mapsat = wfc(light, "MapSaturation")
2312 local smokelist = {}
2313 local holelist = {}
2314 local flashlist = {}
2315 local shelllist = {}
2316 local impactpool = {}
2317 local effectobjects = repeffects.effectobjects
2318 local materialtype = Enum.Material
2319 local materiallist = {
2320 [Enum.Material.Cobblestone] = {
2321 185234383,
2322 185234399,
2323 185234373,
2324 185234412
2325 },
2326 [Enum.Material.Wood] = {
2327 185238181,
2328 185238234,
2329 185238224,
2330 185238210,
2331 185238204
2332 },
2333 [Enum.Material.Brick] = {
2334 185237818,
2335 185237842,
2336 185237826,
2337 185237805
2338 },
2339 [Enum.Material.Plastic] = {
2340 185238152,
2341 185237945,
2342 185237930
2343 },
2344 [Enum.Material.Concrete] = {
2345 185237894,
2346 185237879,
2347 185237865,
2348 185237853
2349 },
2350 Tile = {
2351 185238332,
2352 185238308,
2353 185238298,
2354 185238288,
2355 185238271,
2356 185238257
2357 }
2358 }
2359 local splatter
2360 do
2361 local sort = table.sort
2362 local random = math.random
2363 local log = math.log
2364 local cos = math.cos
2365 local sin = math.sin
2366 local tau = 2 * math.pi
2367 local function gaussian()
2368 local r0 = 1 - random()
2369 local r1 = random() * tau
2370 local l = (-2 * log(r0)) ^ 0.5
2371 return l * cos(r1), l * sin(r1)
2372 end
2373 local function exponential()
2374 return -log(1 - random())
2375 end
2376 local boxn = {
2377 v3(1, 0, 0),
2378 v3(-1, 0, 0),
2379 v3(0, 1, 0),
2380 v3(0, -1, 0),
2381 v3(0, 0, 1),
2382 v3(0, 0, -1)
2383 }
2384 local boxl = {
2385 0.5,
2386 0.5,
2387 0.5,
2388 0.5,
2389 0.5,
2390 0.5
2391 }
2392 local function transform_mesh(meshn, meshl, cframe, size)
2393 local newn = {}
2394 local newl = {}
2395 for i = 1, #meshn do
2396 local n = meshn[i]
2397 local l = meshl[i]
2398 local tn = vtws(cframe, n / size).unit
2399 local tl = dot(cframe * (l * n * size), tn)
2400 newn[i] = tn
2401 newl[i] = tl
2402 end
2403 return newn, newl
2404 end
2405 local function distance_o_1(an, al, o)
2406 local oan = dot(o, an)
2407 return oan - al
2408 end
2409 local function distance_o_2(an, al, bn, bl, o)
2410 local anbn = dot(an, bn)
2411 local oan = dot(o, an)
2412 local obn = dot(o, bn)
2413 local m = (1 - anbn * anbn) ^ 0.5
2414 return (bl - al * anbn + anbn * oan - obn) / m
2415 end
2416 local function dist_from_edge(meshn, meshl, o)
2417 local besta
2418 local bestd = -1 / 0
2419 for i = 1, #meshn do
2420 local an = meshn[i]
2421 local al = meshl[i]
2422 local d = distance_o_1(an, al, o)
2423 if bestd < d then
2424 besta = i
2425 bestd = d
2426 end
2427 end
2428 if not besta then
2429 return 1 / 0
2430 end
2431 local an = meshn[besta]
2432 local al = meshl[besta]
2433 local r = 1 / 0
2434 for i = 1, #meshn do
2435 if i ~= besta then
2436 local bn = meshn[i]
2437 local bl = meshl[i]
2438 local d = distance_o_2(an, al, bn, bl, o)
2439 if r > d then
2440 r = d
2441 end
2442 end
2443 end
2444 return r
2445 end
2446 local meshcache = {}
2447 local function getmesh(part)
2448 local cache = meshcache[part]
2449 if cache then
2450 return cache.meshn, cache.meshl
2451 else
2452 do
2453 local cframe = part.CFrame
2454 local size = part.Size
2455 local meshn, meshl = transform_mesh(boxn, boxl, part.CFrame, part.Size)
2456 meshcache[part] = {meshn = meshn, meshl = meshl}
2457 local event
2458 event = part.Changed:connect(function()
2459 meshcache[part] = nil
2460 event:disconnect()
2461 end)
2462 return meshn, meshl
2463 end
2464 end
2465 end
2466 local function max_radius(part, pos)
2467 local meshn, meshl = getmesh(part)
2468 return dist_from_edge(meshn, meshl, pos)
2469 end
2470 local spartpool = {}
2471 local function getspart()
2472 local pooledpart = spartpool[#spartpool]
2473 if pooledpart then
2474 spartpool[#spartpool] = nil
2475 return pooledpart
2476 else
2477 local spart = Instance.new("Part")
2478 spart.Shape = "Cylinder"
2479 spart.Anchored = true
2480 spart.CanCollide = false
2481 spart.BrickColor = BrickColor.new("Crimson")
2482 return spart
2483 end
2484 end
2485 local function retirespart(part)
2486 spartpool[#spartpool + 1] = part
2487 end
2488 local function sortandmerge(slist, ulist, lt)
2489 sort(ulist, lt)
2490 local mlist = {}
2491 local m = #slist
2492 local n = #ulist
2493 local i = 1
2494 local j = 1
2495 local k = 0
2496 while m >= i and n >= j do
2497 k = k + 1
2498 local a = slist[i]
2499 local b = ulist[j]
2500 if lt(a, b) then
2501 i = i + 1
2502 mlist[k] = a
2503 else
2504 j = j + 1
2505 mlist[k] = b
2506 end
2507 end
2508 for l = i, m do
2509 k = k + 1
2510 mlist[k] = slist[l]
2511 end
2512 for l = j, n do
2513 k = k + 1
2514 mlist[k] = ulist[l]
2515 end
2516 return mlist
2517 end
2518 local queuedsplatters = {}
2519 local queuedretires = {}
2520 local nsplatters = 0
2521 local splatters = {}
2522 local nretires = 0
2523 local retires = {}
2524 local maxbloodt = 1
2525 local compt0 = function(a, b)
2526 return b.t0 < a.t0
2527 end
2528 local compt1 = function(a, b)
2529 return b.t1 < a.t1
2530 end
2531 function effects.setmaxbloodt(newt)
2532 maxbloodt = newt
2533 end
2534 game:GetService("RunService").RenderStepped:connect(function()
2535 debug.profilebegin("blood creation/removal")
2536 local t = tick()
2537 if nsplatters > 0 then
2538 queuedsplatters = sortandmerge(queuedsplatters, splatters, compt0)
2539 nsplatters = 0
2540 splatters = {}
2541 end
2542 for i = #queuedsplatters, 1, -1 do
2543 if maxbloodt / 1000 < tick() - t then
2544 break
2545 end
2546 local splat = queuedsplatters[i]
2547 if t > splat.t0 then
2548 queuedsplatters[i] = nil
2549 local spart = getspart()
2550 local size = splat.size
2551 local part = splat.part
2552 local norm = splat.norm
2553 local pos = splat.pos
2554 local maxsize = 2 * max_radius(part, pos)
2555 if size > maxsize then
2556 size = maxsize
2557 end
2558 local spart = getspart()
2559 spart.Size = v3(0.05, size, size)
2560 spart.CFrame = cf(pos, pos + norm) * angles(0, tau / 4, 0)
2561 spart.Parent = workspace.Ignore
2562 nretires = nretires + 1
2563 retires[nretires] = {
2564 t1 = splat.t1,
2565 spart = spart
2566 }
2567 else
2568 break
2569 end
2570 end
2571 if nretires > 0 then
2572 queuedretires = sortandmerge(queuedretires, retires, compt1)
2573 nretires = 0
2574 retires = {}
2575 end
2576 for i = #queuedretires, 1, -1 do
2577 if maxbloodt / 1000 < tick() - t then
2578 break
2579 end
2580 local retire = queuedretires[i]
2581 if t > retire.t1 then
2582 queuedretires[i] = nil
2583 retire.spart.Parent = nil
2584 retirespart(retire.spart)
2585 else
2586 break
2587 end
2588 end
2589 debug.profileend()
2590 end)
2591 function splatter(splots, avgsize, orig, velocity, spread, dist, ignorelist, life0, life1)
2592 debug.profilebegin("blood initialization")
2593 local ct = tick()
2594 local v = spread * velocity.magnitude
2595 for i = 1, splots do
2596 local r0, r1 = gaussian()
2597 local r2 = gaussian()
2598 local r3 = exponential()
2599 local dir = velocity + v3(v * r0, v * r1, v * r2)
2600 local size = avgsize * r3
2601 local part, pos, norm = raycast(workspace, ray(orig, dist * dir.unit), ignorelist)
2602 if part then
2603 nsplatters = nsplatters + 1
2604 local t0 = ct + dot(dir, pos - orig) / dot(dir, dir)
2605 local t1 = t0 + random() * (life1 - life0) + life0
2606 splatters[nsplatters] = {
2607 t0 = t0,
2608 t1 = t1,
2609 size = size,
2610 part = part,
2611 norm = norm,
2612 pos = pos
2613 }
2614 end
2615 end
2616 debug.profileend()
2617 end
2618 end
2619 function effects:ejectshell(trigger, guntype, offset)
2620 local shellpart
2621 if #shelllist ~= 0 then
2622 shellpart = shelllist[#shelllist]
2623 shelllist[#shelllist] = nil
2624 else
2625 shellpart = shell:Clone()
2626 end
2627 delay(0.1, function()
2628 shellpart.CFrame = trigger.CFrame * angles((90 + random(-5, 5)) * deg, random(-5, 5) * deg, random(-5, 5) * deg) * offset
2629 shellpart.RotVelocity = v3(random(-5, 5), random(-5, 5), random(-5, 5))
2630 shellpart.Parent = ignore
2631 shellpart.BodyThrust.force = v3(3.5, 0.1, -3)
2632 wait(0.05)
2633 shellpart.BodyThrust.force = v3(-0.5, 0, 0)
2634 wait(0.1)
2635 shellpart.BodyThrust.force = v3(0, 0, 0)
2636 wait(0.1)
2637 shellpart.Velocity = v3()
2638 shellpart.Parent = nil
2639 shelllist[#shelllist + 1] = shellpart
2640 end)
2641 end
2642 function effects:muzzleflash(barrel)
2643 local flashpart
2644 if #flashlist ~= 0 then
2645 flashpart = flashlist[#flashlist]
2646 flashlist[#flashlist] = nil
2647 else
2648 flashpart = flash:Clone()
2649 end
2650 local flare = ffc(flashpart, "Flare")
2651 local spark = ffc(flashpart, "Spark")
2652 if not flare or not spark then
2653 trash.remove(flashpart)
2654 flashpart = flash:Clone()
2655 flare = ffc(flashpart, "Flare")
2656 spark = ffc(flashpart, "Spark")
2657 end
2658 flashpart.Enabled = true
2659 flashpart.Parent = pgui
2660 flashpart.Adornee = barrel
2661 flare.Rotation = random(0, 360)
2662 flare.Size = ud2(0, 20, 0, 20)
2663 flare.Position = ud2(0.5, -10, 0.5, -10)
2664 spark.Rotation = random(0, 360)
2665 spark.Size = ud2(0, 200, 0, 200)
2666 spark.Position = ud2(0.5, -100, 0.5, -100)
2667 spark.Visible = true
2668 flare:TweenSizeAndPosition(ud2(0, 1000, 0, 1000), ud2(0.5, -500, 0.5, -500), "Out", "Sine", 0.2)
2669 spark:TweenSizeAndPosition(ud2(0, 500, 0, 500), ud2(0.5, -250, 0.5, -250), "Out", "Sine", 0.15)
2670 delay(0.05, function()
2671 spark.Visible = false
2672 wait(0.05)
2673 flashpart.Enabled = false
2674 wait(0.5)
2675 flashpart.Parent = nil
2676 flashlist[#flashlist + 1] = flashpart
2677 end)
2678 char:firemuzzlelight()
2679 end
2680 function effects:breakwindow(hit, pos, norm, force, nobulleteffect)
2681 hit.Parent = ignore
2682 network:send("b" .. "r" .. "e" .. "a" .. "k" .. "w" .. "i" .. "n" .. "d" .. "o" .. "w", hit)
2683 if not nobulleteffect then
2684 effects:bullethit(hit, pos, norm, false, false, 3)
2685 end
2686 end
2687 function effects:bloodhit(start, hit, pos, norm, enablesplatter, damage, velocity)
2688 local damage = damage or 20
2689 if damage > 100 then
2690 damage = 100
2691 end
2692 network:send("b" .. "l" .. "o" .. "o" .. "d" .. "h" .. "i" .. "t", start, hit, pos, norm, enablesplatter, damage / 3, velocity)
2693 createblood(start, hit, pos, norm, enablesplatter, damage, velocity)
2694 end
2695 function effects:enablemapshaders(on)
2696 local shaderlist = {mapsat, mapray}
2697 for i = 1, #shaderlist do
2698 if effects.disableshaders then
2699 shaderlist[i].Enabled = false
2700 else
2701 shaderlist[i].Enabled = on
2702 end
2703 end
2704 end
2705 function createblood(start, hit, pos, norm, enablesplatter, damage, velocity)
2706 if input.consoleon or effects.disableblood then
2707 return
2708 end
2709 local size = 1
2710 local ignorelist = {
2711 ignore,
2712 workspace.DeadBody,
2713 workspace.CurrentCamera
2714 }
2715 local pp = game:GetService("Players"):GetPlayers()
2716 for i = 1, #pp do
2717 ignorelist[#ignorelist + 1] = pp[i].Character
2718 end
2719 if enablesplatter then
2720 local damage = damage or 20
2721 local splots = damage / 2
2722 splatter(splots, 0.5, pos, velocity, 0.125, 20, ignorelist, 7, 15)
2723 end
2724 local bloodpart = hole:Clone()
2725 bloodpart.Parent = ignore
2726 bloodpart.CFrame = cf(pos)
2727 bloodpart.Transparency = 1
2728 bloodpart:ClearAllChildren()
2729 local test = repeffects.BloodTest:Clone()
2730 test.Parent = bloodpart
2731 test.Rate = test.Rate * size
2732 test.Enabled = true
2733 spawn(function()
2734 wait(0.1)
2735 test.Enabled = false
2736 end)
2737 debris:AddItem(bloodpart, 3)
2738 end
2739 network:add("createblood", createblood)
2740 function effects:bullethit(hit, pos, norm, smokeon, holeon, sparkson)
2741 if hit.Transparency == 1 then
2742 return
2743 end
2744 local light = hit:FindFirstChildOfClass("SpotLight") or hit:FindFirstChildOfClass("PointLight") or hit:FindFirstChildOfClass("SurfaceLight")
2745 if light then
2746 light:Destroy()
2747 for i = 1, 10 do
2748 particle.new({
2749 position = pos,
2750 velocity = norm * 30 + vector.random(10),
2751 acceleration = v3(0, -20, 0),
2752 cancollide = false,
2753 size = 0.1,
2754 brightness = 20 * random(),
2755 color = Color3.new(1, 1, 0.8),
2756 bloom = 0.005 * random(),
2757 life = 10,
2758 physicsonly = true
2759 })
2760 end
2761 network:send("breaklights", hit)
2762 end
2763 if not effects.disablerobloxparticles and smokeon then
2764 do
2765 local impacttype
2766 if hit.Name == "Terrain" then
2767 impacttype = "ImpactWater"
2768 elseif hit.Material == Enum.Material.Grass then
2769 impacttype = "ImpactGrass"
2770 elseif eventmod.ison() then
2771 impacttype = "ImpactLaser"
2772 else
2773 impacttype = "ImpactDefault"
2774 end
2775 local impact
2776 local pool = impactpool[impacttype]
2777 if not pool then
2778 impactpool[impacttype] = {}
2779 pool = impactpool[impacttype]
2780 end
2781 if #pool == 0 then
2782 impact = effectobjects[impacttype]:Clone()
2783 impact.Parent = ignore
2784 else
2785 impact = pool[#pool]
2786 pool[#pool] = nil
2787 end
2788 impact.CFrame = cf(pos, pos + 2 * norm + v3(random() - 0.5, random() - 0.5, random() - 0.5))
2789 local pt = impact:GetChildren()
2790 for i = 1, #pt do
2791 if pt[i]:IsA("ParticleEmitter") then
2792 pt[i].Acceleration = v3(5 * (random() - 0.5), pt[i].Acceleration.Y, 5 * (random() - 0.5))
2793 pt[i].EmissionDirection = "Front"
2794 pt[i]:Emit(pt[i].Rate / 10)
2795 end
2796 end
2797 if impacttype == "Impact1" then
2798 impact.effcloud.EmissionDirection = random(0, 5)
2799 end
2800 delay(0.05, function()
2801 pool[#pool + 1] = impact
2802 end)
2803 end
2804 end
2805 if holeon and hit.Transparency == 0 and hit.CanCollide then
2806 do
2807 local holepart
2808 if #holelist ~= 0 then
2809 holepart = holelist[#holelist]
2810 holelist[#holelist] = nil
2811 else
2812 holepart = hole:Clone()
2813 end
2814 holepart:BreakJoints()
2815 holepart.Parent = ignore
2816 holepart.CFrame = cf(pos, pos - norm) * angles(-90 * deg, random(0, 360) * deg, 0)
2817 local materials = materiallist[Enum.Material.Cobblestone]
2818 if materiallist[hit.Material] then
2819 materials = materiallist[hit.Material]
2820 end
2821 local randId = "http://www.roblox.com/asset/?id=" .. materials[random(1, #materials)]
2822 holepart.Decal1.Texture = randId
2823 holepart.Decal2.Texture = randId
2824 delay(4, function()
2825 holepart.Parent = nil
2826 holelist[#holelist + 1] = holepart
2827 end)
2828 end
2829 end
2830 end
2831 function effects:reload()
2832 smokelist = {}
2833 holelist = {}
2834 flashlist = {}
2835 shelllist = {}
2836 end
2837 effects:reload()
2838end
2839print("Loading tween module")
2840do
2841 local type = type
2842 local halfpi = math.pi / 2
2843 local acos = math.acos
2844 local sin = math.sin
2845 local cf = CFrame.new
2846 local tos = cf().toObjectSpace
2847 local components = cf().components
2848 local tick = tick
2849 local tweendata = {}
2850 local equations = {
2851 linear = {
2852 p0 = 0,
2853 v0 = 1,
2854 p1 = 1,
2855 v1 = 1
2856 },
2857 smooth = {
2858 p0 = 0,
2859 v0 = 0,
2860 p1 = 1,
2861 v1 = 0
2862 },
2863 accelerate = {
2864 p0 = 0,
2865 v0 = 0,
2866 p1 = 1,
2867 v1 = 1
2868 },
2869 decelerate = {
2870 p0 = 0,
2871 v0 = 1,
2872 p1 = 1,
2873 v1 = 0
2874 },
2875 bump = {
2876 p0 = 0,
2877 v0 = 4,
2878 p1 = 0,
2879 v1 = -4
2880 },
2881 acceleratebump = {
2882 p0 = 0,
2883 v0 = 0,
2884 p1 = 0,
2885 v1 = -6.75
2886 },
2887 deceleratebump = {
2888 p0 = 0,
2889 v0 = 6.75,
2890 p1 = 0,
2891 v1 = 0
2892 }
2893 }
2894 local updater = {}
2895 tween.step = event.new(updater)
2896 function tween.tweencframe(object, index, time, equation, nextcframe)
2897 if tweendata[object] then
2898 tweendata[object]()
2899 end
2900 local t0 = tick()
2901 local p0, v0, p1, v1
2902 if type(equation) == "table" then
2903 p0 = equation[1]
2904 v0 = equation[2]
2905 p1 = equation[3]
2906 v1 = equation[4]
2907 else
2908 local eq = equations[equation]
2909 p0, v0, p1, v1 = eq.p0, eq.v0, eq.p1, eq.v1
2910 end
2911 local interpolator = cframe.interpolator(object[index], nextcframe)
2912 local stop
2913 stop = updater:connect(function()
2914 local u = (tick() - t0) / time
2915 if u > 1 then
2916 object[index] = interpolator(p1)
2917 stop()
2918 tweendata[object] = nil
2919 else
2920 local v = 1 - u
2921 local t = p0 * v * v * v + (3 * p0 + v0) * u * v * v + (3 * p1 - v1) * u * u * v + p1 * u * u * u
2922 object[index] = interpolator(t)
2923 end
2924 end)
2925 tweendata[object] = stop
2926 return stop
2927 end
2928 function tween.freebody(object, index, life, cframe0, velocity0, rotation0, acceleration)
2929 local position0 = cframe0.p
2930 local matrix0 = cframe0 - position0
2931 local tick0 = tick()
2932 local stop
2933 stop = updater:connect(function()
2934 local t = tick() - tick0
2935 if life and t > life then
2936 stop()
2937 trash.remove(object)
2938 end
2939 object[index] = cframe.fromaxisangle(t * rotation0) * matrix0 + position0 + t * velocity0 + t * t * acceleration
2940 end)
2941 return stop
2942 end
2943end
2944print("Loading input module")
2945do
2946 local tick = tick
2947 local lower = string.lower
2948 local nv = Vector3.new()
2949 local userinput = game:GetService("UserInputService")
2950 local abbreviation = {
2951 ButtonX = "x",
2952 ButtonY = "y",
2953 ButtonA = "a",
2954 ButtonB = "b",
2955 ButtonR1 = "r1",
2956 ButtonL1 = "l1",
2957 ButtonR2 = "r2",
2958 ButtonL2 = "l2",
2959 ButtonR3 = "r3",
2960 ButtonL3 = "l3",
2961 ButtonStart = "start",
2962 ButtonSelect = "select",
2963 DPadLeft = "left",
2964 DPadRight = "right",
2965 DPadUp = "up",
2966 DPadDown = "down"
2967 }
2968 input.keyboard = {}
2969 input.keyboard.down = {}
2970 input.keyboard.onkeydown = {}
2971 input.keyboard.onkeyup = {}
2972 input.mouse = {}
2973 input.mouse.Position = nv
2974 input.mouse.down = {}
2975 input.mouse.onbuttondown = {}
2976 input.mouse.onbuttonup = {}
2977 input.mouse.onmousemove = {}
2978 input.mouse.onscroll = {}
2979 input.controller = {}
2980 input.controller.down = {}
2981 input.controller.onbuttondown = {}
2982 input.controller.onbuttonup = {}
2983 input.controller.onintegralmove = {}
2984 input.consoleon = not userinput.KeyboardEnabled
2985 local fireonkeydown = event.new(input.keyboard.onkeydown)
2986 local fireonkeyup = event.new(input.keyboard.onkeyup)
2987 local fireonbuttondown = event.new(input.mouse.onbuttondown)
2988 local fireonbuttonup = event.new(input.mouse.onbuttonup)
2989 local fireonmousemove = event.new(input.mouse.onmousemove)
2990 local fireonscroll = event.new(input.mouse.onscroll)
2991 local fireoncbuttondown = event.new(input.controller.onbuttondown)
2992 local fireoncbuttonup = event.new(input.controller.onbuttonup)
2993 local fireonintegralmove = event.new(input.controller.onintegralmove)
2994 local keymap = {}
2995 local triggerthreshold = 0.2
2996 local stickthreshold = 0.25
2997 local gamepadpos
2998 local triggeron = {}
2999 local typing
3000 function input.iskeydown(key)
3001 return userinput:GetKeysPressed()[key]
3002 end
3003 userinput.TextBoxFocused:connect(function()
3004 typing = true
3005 end)
3006 userinput.TextBoxFocusReleased:connect(function()
3007 typing = false
3008 end)
3009 userinput.InputChanged:connect(function(object)
3010 local type = object.UserInputType.Name
3011 local pos = object.Position
3012 if type == "MouseMovement" then
3013 input.mouse.position = pos
3014 fireonmousemove(object.Delta)
3015 elseif type == "MouseWheel" then
3016 fireonscroll(pos.z)
3017 elseif type == "Gamepad1" then
3018 local key = object.KeyCode.Name
3019 if key == "Thumbstick2" then
3020 local m = pos.magnitude
3021 if m > stickthreshold then
3022 gamepadpos = (1 - stickthreshold / m) / (1 - stickthreshold) * pos
3023 elseif gamepadpos then
3024 gamepadpos = nil
3025 end
3026 elseif key == "ButtonL2" or key == "ButtonR2" then
3027 local abv = abbreviation[key]
3028 if triggerthreshold < pos.z and not input.controller.down[abv] then
3029 local mappedkey = keymap[abv]
3030 if mappedkey then
3031 input.keyboard.down[mappedkey] = tick()
3032 fireonkeydown(mappedkey)
3033 end
3034 input.controller.down[abv] = tick()
3035 fireoncbuttondown(abv)
3036 elseif pos.z < triggerthreshold and input.controller.down[abv] then
3037 local mappedkey = keymap[abv]
3038 if mappedkey then
3039 input.keyboard.down[mappedkey] = nil
3040 fireonkeyup(mappedkey)
3041 end
3042 input.controller.down[abv] = nil
3043 fireoncbuttonup(abv)
3044 end
3045 end
3046 end
3047 end)
3048 userinput.InputBegan:connect(function(object)
3049 if typing or char.health and char.health <= 0 then
3050 return
3051 end
3052 local type = object.UserInputType.Name
3053 if type == "Keyboard" then
3054 local key = lower(object.KeyCode.Name)
3055 input.keyboard.down[key] = tick()
3056 fireonkeydown(key)
3057 elseif type == "Gamepad1" then
3058 local key = abbreviation[object.KeyCode.Name]
3059 if key and key ~= "l2" and key ~= "r2" or not input.controller.down[key] then
3060 local mappedkey = keymap[key]
3061 if mappedkey then
3062 input.keyboard.down[mappedkey] = tick()
3063 fireonkeydown(mappedkey)
3064 end
3065 input.controller.down[key] = tick()
3066 fireoncbuttondown(key)
3067 end
3068 elseif type == "MouseButton1" then
3069 input.mouse.down.left = tick()
3070 fireonbuttondown("left")
3071 elseif type == "MouseButton2" then
3072 input.mouse.down.right = tick()
3073 fireonbuttondown("right")
3074 elseif type == "MouseButton3" then
3075 input.mouse.down.middle = tick()
3076 fireonbuttondown("middle")
3077 end
3078 end)
3079 userinput.InputEnded:connect(function(object)
3080 if typing then
3081 return
3082 end
3083 local type = object.UserInputType.Name
3084 if type == "Keyboard" then
3085 local key = lower(object.KeyCode.Name)
3086 input.keyboard.down[key] = nil
3087 fireonkeyup(key)
3088 elseif type == "Gamepad1" then
3089 local key = abbreviation[object.KeyCode.Name]
3090 if key and key ~= "l2" and key ~= "r2" or input.controller.down[key] then
3091 local mappedkey = keymap[key]
3092 if mappedkey then
3093 input.keyboard.down[mappedkey] = nil
3094 fireonkeyup(mappedkey)
3095 end
3096 input.controller.down[key] = nil
3097 fireoncbuttonup(key)
3098 end
3099 elseif type == "MouseButton1" then
3100 input.mouse.down.left = nil
3101 fireonbuttonup("left")
3102 elseif type == "MouseButton2" then
3103 input.mouse.down.right = nil
3104 fireonbuttonup("right")
3105 elseif type == "MouseButton3" then
3106 input.mouse.down.middle = nil
3107 fireonbuttonup("middle")
3108 end
3109 end)
3110 function input.mouse:hide()
3111 userinput.MouseIconEnabled = false
3112 end
3113 function input.mouse:show()
3114 userinput.MouseIconEnabled = true
3115 end
3116 function input.mouse.visible()
3117 return userinput.MouseIconEnabled
3118 end
3119 function input.mouse:lockcenter()
3120 userinput.MouseBehavior = "LockCenter"
3121 end
3122 function input.mouse:free()
3123 userinput.MouseBehavior = "Default"
3124 end
3125 function input.mouse:lock()
3126 userinput.MouseBehavior = "LockCurrentPosition"
3127 end
3128 function input.controller:map(button, key)
3129 keymap[button] = key
3130 end
3131 function input.controller:unmap(button)
3132 keymap[button] = nil
3133 end
3134 function input.step(dt)
3135 if gamepadpos then
3136 fireonintegralmove(dt * gamepadpos, dt)
3137 end
3138 end
3139end
3140print("Loading animation module")
3141do
3142 local sin = math.sin
3143 local acos = math.acos
3144 local type = type
3145 local next = next
3146 local tick = tick
3147 local cf = CFrame.new
3148 local v3 = vector.new
3149 local nv = v3()
3150 local inverse = CFrame.new().inverse
3151 local tos = CFrame.new().toObjectSpace
3152 local toquaternion = cframe.toquaternion
3153 local clone = game.Clone
3154 local new = Instance.new
3155 local play = new("Sound").Play
3156 local stop = new("Sound").Stop
3157 local equations = {
3158 linear = {
3159 p0 = 0,
3160 v0 = 1,
3161 p1 = 1,
3162 v1 = 1
3163 },
3164 smooth = {
3165 p0 = 0,
3166 v0 = 0,
3167 p1 = 1,
3168 v1 = 0
3169 },
3170 accelerate = {
3171 p0 = 0,
3172 v0 = 0,
3173 p1 = 1,
3174 v1 = 1
3175 },
3176 decelerate = {
3177 p0 = 0,
3178 v0 = 1,
3179 p1 = 1,
3180 v1 = 0
3181 },
3182 bump = {
3183 p0 = 0,
3184 v0 = 4,
3185 p1 = 0,
3186 v1 = -4
3187 },
3188 acceleratebump = {
3189 p0 = 0,
3190 v0 = 0,
3191 p1 = 0,
3192 v1 = -6.75
3193 },
3194 deceleratebump = {
3195 p0 = 0,
3196 v0 = 6.75,
3197 p1 = 0,
3198 v1 = 0
3199 }
3200 }
3201 local function interpolator(c0, c1, t0, dur, eq, pivot)
3202 pivot = pivot or nv
3203 c0 = c0 * cf(pivot)
3204 c1 = c1 * cf(pivot)
3205 local p0, v0, p1, v1
3206 if type(eq) == "table" then
3207 p0, v0, p1, v1 = eq[1], eq[2], eq[3], eq[4]
3208 else
3209 local eq = equations[eq or "smooth"]
3210 p0, v0, p1, v1 = eq.p0, eq.v0, eq.p1, eq.v1
3211 end
3212 return function(t)
3213 t = (t - t0) / dur
3214 t = t < 1 and t or 1
3215 local i = 1 - t
3216 local v = p0 * i * i * i + (3 * p0 + v0) * t * i * i + (3 * p1 - v1) * t * t * i + p1 * t * t * t
3217 return cframe.interpolate(c0, c1, v) * cf(-pivot), 1 == t
3218 end
3219 end
3220 function animation.player(modeldata, sequence)
3221 local interpolators = {}
3222 local framenumber = 1
3223 local t0 = 0
3224 local lasttime = t0
3225 local stdtimescale = sequence.stdtimescale
3226 local timescale = sequence.timescale
3227 local cframes = {}
3228 local lastcframes = {}
3229 local ignore = workspace.Ignore
3230 local player = game:GetService("Players").LocalPlayer
3231 for i, v in next, modeldata, nil do
3232 if v.part then
3233 lastcframes[i] = v.part.CFrame
3234 cframes[i] = v.part.CFrame
3235 end
3236 end
3237 return function(time)
3238 local dt = time - lasttime
3239 lasttime = time
3240 for i = framenumber, #sequence do
3241 local frame = sequence[i]
3242 if time > t0 then
3243 for i = 1, #frame do
3244 local data = frame[i]
3245 local partname = data.part
3246 if not modeldata[partname] then
3247 error("Error in frame: " .. framenumber .. ". " .. partname .. " is not in modeldata")
3248 end
3249 if data.c0 then
3250 interpolators[partname] = nil
3251 modeldata[partname].weld.C0 = data.c0 == "base" and modeldata[partname].basec0 or data.c0
3252 end
3253 if data.c1 then
3254 interpolators[partname] = interpolator(modeldata[partname].weld.C0, data.c1 == "base" and modeldata[partname].basec0 or data.c1, t0, data.t and data.t * timescale or frame.delay * timescale, data.eq, data.pivot)
3255 end
3256 if data.clone then
3257 if modeldata[data.clone] then
3258 error("Error in frame: " .. framenumber .. ". Cannot clone " .. partname .. ". " .. data.clone .. " already exists.")
3259 end
3260 local part = clone(modeldata[partname].part)
3261 part.Parent = ignore
3262 part:ClearAllChildren()
3263 local tt = modeldata[partname].part:GetChildren()
3264 for i = 1, #tt do
3265 if tt[i]:IsA("Texture") then
3266 local trans = modeldata.camodata[modeldata[partname].part][tt[i]].Transparency
3267 local hackytt = tt[i]:Clone()
3268 hackytt.Transparency = trans
3269 hackytt.Parent = part
3270 elseif tt[i]:IsA("FileMesh") then
3271 tt[i]:Clone().Parent = part
3272 end
3273 end
3274 local weld = new("Motor6D", part)
3275 local part0 = data.part0 and modeldata[data.part0].part or modeldata[partname].weld.Part0
3276 weld.Part0 = part0
3277 weld.Part1 = part
3278 weld.C0 = part0.CFrame:inverse() * modeldata[partname].weld.Part0.CFrame * modeldata[partname].weld.C0
3279 modeldata[data.clone] = {
3280 part = part,
3281 weld = weld,
3282 clone = true
3283 }
3284 cframes[data.clone] = cframes[partname]
3285 lastcframes[data.clone] = lastcframes[partname]
3286 end
3287 if data.transparency then
3288 modeldata[partname].part.Transparency = data.transparency
3289 if modeldata.camodata and modeldata.camodata[modeldata[partname].part] then
3290 local tt = modeldata[partname].part:GetChildren()
3291 for i = 1, #tt do
3292 if tt[i]:IsA("Texture") or tt[i]:IsA("Decal") then
3293 local trans = modeldata.camodata[modeldata[partname].part][tt[i]].Transparency
3294 tt[i].Transparency = data.transparency ~= 1 and trans or 1
3295 end
3296 end
3297 end
3298 end
3299 if data.sound then
3300 do
3301 local sound = new("Sound")
3302 if data.soundid then
3303 sound.SoundId = data.soundid
3304 end
3305 if data.v then
3306 sound.Volume = data.v
3307 end
3308 if data.p then
3309 sound.Pitch = data.p
3310 end
3311 if data.tp then
3312 sound.TimePosition = data.tp
3313 else
3314 sound.TimePosition = 0
3315 end
3316 if data.head then
3317 sound.Parent = player.Character.Head
3318 else
3319 sound.Parent = modeldata[partname].part
3320 end
3321 sound:Play()
3322 if data.d then
3323 delay(data.d, function()
3324 sound:Stop()
3325 end)
3326 end
3327 end
3328 end
3329 if data.drop then
3330 if not modeldata[partname].clone then
3331 error("Error in frame: " .. framenumber .. ". Cannot drop " .. partname .. ". Part is not a clone")
3332 end
3333 local lastcf = lastcframes[partname]
3334 local curcf = cframes[partname]
3335 tween.freebody(modeldata[partname].part, "CFrame", timescale / stdtimescale, modeldata[partname].part.CFrame, (curcf.p - lastcf.p) / dt, cframe.toaxisangle(curcf * lastcf:inverse()) / dt, v3(0, -196.2 / stdtimescale * stdtimescale * (timescale * timescale), 0))
3336 trash.remove(modeldata[partname].weld)
3337 modeldata[partname] = nil
3338 interpolators[partname] = nil
3339 end
3340 if data.delete then
3341 trash.remove(modeldata[partname].weld)
3342 trash.remove(modeldata[partname].part)
3343 modeldata[partname] = nil
3344 interpolators[partname] = nil
3345 end
3346 end
3347 t0 = t0 + frame.delay * timescale
3348 framenumber = framenumber + 1
3349 else
3350 break
3351 end
3352 end
3353 for i, v in next, interpolators, nil do
3354 local newcf, stop, t = v(time)
3355 modeldata[i].weld.C0 = newcf
3356 if stop then
3357 interpolators[i] = nil
3358 end
3359 end
3360 for i, v in next, modeldata, nil do
3361 if v.part then
3362 lastcframes[i] = cframes[i]
3363 cframes[i] = v.part.CFrame
3364 end
3365 end
3366 if time > t0 then
3367 for i, v in next, modeldata, nil do
3368 if v.clone then
3369 trash.remove(v.weld)
3370 trash.remove(v.part)
3371 modeldata[i] = nil
3372 end
3373 end
3374 end
3375 return time > t0
3376 end
3377 end
3378 function animation.reset(modeldata, t)
3379 local interpolators = {}
3380 for i, v in next, modeldata, nil do
3381 if v.clone then
3382 modeldata[i] = nil
3383 trash.remove(v.weld)
3384 trash.remove(v.part)
3385 else
3386 if v.part then
3387 v.part.Transparency = v.basetransparency
3388 if modeldata.camodata and modeldata.camodata[v.part] then
3389 local tt = v.part:GetChildren()
3390 for i = 1, #tt do
3391 if tt[i]:IsA("Texture") or tt[i]:IsA("Decal") then
3392 local trans = modeldata.camodata[v.part][tt[i]].Transparency
3393 tt[i].Transparency = trans
3394 end
3395 end
3396 end
3397 end
3398 if v.weld then
3399 interpolators[i] = interpolator(v.weld.C0, v.basec0, 0, t or 1)
3400 end
3401 end
3402 end
3403 return function(time)
3404 for i, v in next, interpolators, nil do
3405 local newcf, stop = v(time)
3406 modeldata[i].weld.C0 = newcf
3407 end
3408 return time > t
3409 end
3410 end
3411end
3412print("Loading chat module")
3413do
3414 local wfc = game.WaitForChild
3415 local ffc = game.FindFirstChild
3416 local ud2 = UDim2.new
3417 local ceil = math.ceil
3418 local cf = CFrame.new
3419 local v3 = Vector3.new
3420 local color = Color3.new
3421 local dot = Vector3.new().Dot
3422 local workspace = workspace
3423 local ray = Ray.new
3424 local new = Instance.new
3425 local rtype = game.IsA
3426 local debris = game.Debris
3427 local sub = string.sub
3428 local len = string.len
3429 local lower = string.lower
3430 local find = string.find
3431 local insert = table.insert
3432 local match = string.match
3433 local player = game:GetService("Players").LocalPlayer
3434 local pgui = player.PlayerGui
3435 local misc = game.ReplicatedStorage.Misc
3436 local msg = wfc(misc, "Msger")
3437 local chatgui = wfc(pgui, "ChatGame")
3438 local chatbox = wfc(chatgui, "TextBox")
3439 local warn = wfc(chatgui, "Warn")
3440 local version = wfc(chatgui, "Version")
3441 local globalchat = wfc(chatgui, "GlobalChat")
3442 local guesttip = wfc(chatgui, "GuestTip")
3443 version.Text = "Server version: " .. updateversion
3444 local admin, moderator
3445 local adminlist = {
3446 525919,
3447 1667819,
3448 5725475,
3449 4337002
3450 }
3451 local moderatorlist = {66366193, 70273584}
3452 local banlist = {}
3453 local canchat = true
3454 local chatspam = 0
3455 local totalspam = 0
3456 local maxchar = 400
3457 local lines = 8
3458 local chatting
3459 local isguest = player.UserId < 0 and not game:GetService("RunService"):IsStudio()
3460 for i = 1, #adminlist do
3461 if adminlist[i] == player.userId then
3462 admin = true
3463 end
3464 end
3465 for i = 1, #moderatorlist do
3466 if moderatorlist[i] == player.userId then
3467 moderator = true
3468 end
3469 end
3470 for i = 1, #banlist do
3471 if banlist[i] == player.Name then
3472 player:kick("Banlist kick")
3473 end
3474 end
3475 network:add("console", function(message)
3476 local mes = msg:Clone()
3477 local mtag = wfc(mes, "Tag")
3478 local offset = 5
3479 mes.Parent = globalchat
3480 mes.Text = "[Console]: "
3481 mes.TextColor3 = Color3.new(0.4, 0.4, 0.4)
3482 mes.Msg.Text = message
3483 mes.Msg.Position = ud2(0, mes.TextBounds.x, 0, 0)
3484 end)
3485 network:add("announce", function(message)
3486 local mes = msg:Clone()
3487 local mtag = wfc(mes, "Tag")
3488 local offset = 5
3489 mes.Parent = globalchat
3490 mes.Text = "[ANNOUNCEMENT]: "
3491 mes.TextColor3 = Color3.new(0.9803921568627451, 0.6509803921568628, 0.10196078431372549)
3492 mes.Msg.Text = message
3493 mes.Msg.Position = ud2(0, mes.TextBounds.x, 0, 0)
3494 end)
3495 network:add("chatted", function(chatter, text, tag, tagcolor, teamchat, chattername)
3496 if teamchat and chatter.TeamColor ~= player.TeamColor then
3497 return
3498 end
3499 local mes = msg:Clone()
3500 local mtag = wfc(mes, "Tag")
3501 mes.Parent = globalchat
3502 local offset = 5
3503 mtag.Text = tag and tag .. " " or ""
3504 if tag then
3505 offset = mtag.TextBounds.x + 5
3506 mes.Position = ud2(0.01, offset, 1, 20)
3507 mtag.Position = ud2(0, -offset + 5, 0, 0)
3508 if tagcolor then
3509 mtag.TextColor3 = tagcolor
3510 end
3511 end
3512 mes.Text = chattername .. " : "
3513 mes.TextColor = chatter.TeamColor
3514 mes.Msg.Text = text
3515 mes.Msg.Position = ud2(0, mes.TextBounds.x, 0, 0)
3516 end)
3517 local eval
3518 do
3519 local math = math
3520 local byte = string.byte
3521 local find = string.find
3522 local lparen = byte("(")
3523 local rparen = byte(")")
3524 local add = byte("+")
3525 local sub = byte("-")
3526 local mul = byte("*")
3527 local div = byte("/")
3528 local pow = byte("^")
3529 local mod = byte("%")
3530 local zero = byte("0")
3531 local nine = byte("9")
3532 local dot = byte(".")
3533 local space = byte(" ")
3534 local tab = byte("\t")
3535 local newl = byte("\n")
3536 local arith = {
3537 [add] = function(a, b)
3538 return a + b
3539 end,
3540 [sub] = function(a, b)
3541 return a - b
3542 end,
3543 [mul] = function(a, b)
3544 return a * b
3545 end,
3546 [div] = function(a, b)
3547 return a / b
3548 end,
3549 [pow] = function(a, b)
3550 return a ^ b
3551 end,
3552 [mod] = function(a, b)
3553 return a % b
3554 end
3555 }
3556 local whitespace = {
3557 [space] = true,
3558 [tab] = true,
3559 [newl] = true
3560 }
3561 local function f(eq, i)
3562 local neq = #eq
3563 local n = 0
3564 local op = add
3565 local func, m, x, _
3566 while i <= neq do
3567 local c = byte(eq, i)
3568 if arith[c] then
3569 op = c
3570 elseif c == rparen then
3571 break
3572 elseif whitespace[c] then
3573 else
3574 if c == lparen then
3575 m, i = f(eq, i + 1)
3576 elseif c >= zero and c <= nine or c == dot then
3577 _, i, m = find(eq, "(%d*%.?%d*)", i)
3578 else
3579 _, i, func = find(eq, "(%a*)%(", i)
3580 if i then
3581 x, i = f(eq, i + 1)
3582 m = math[func](x)
3583 else
3584 return
3585 end
3586 end
3587 n = arith[op](n, m)
3588 end
3589 i = i + 1
3590 end
3591 return n, i
3592 end
3593 function eval(eq)
3594 return (f(eq, 1))
3595 end
3596 end
3597 local function findplayer(name, speaker)
3598 if lower(name) == "all" then
3599 local chars = {}
3600 local c = game:GetService("Players"):GetPlayers()
3601 for i = 1, #c do
3602 insert(chars, c[i])
3603 end
3604 return chars
3605 elseif lower(name) == "me" then
3606 return {speaker}
3607 elseif lower(name) == "others" then
3608 local chars = {}
3609 local c = game:GetService("Players"):GetPlayers()
3610 for i = 1, #c do
3611 if c ~= speaker then
3612 insert(chars, c[i])
3613 end
3614 end
3615 return chars
3616 else
3617 local chars = {}
3618 local commalist = {}
3619 local ssn = 0
3620 local lownum = 1
3621 local highestnum = 1
3622 local foundone
3623 while true do
3624 ssn = ssn + 1
3625 if sub(name, ssn, ssn) == "" then
3626 insert(commalist, lownum)
3627 insert(commalist, ssn - 1)
3628 highestnum = ssn - 1
3629 break
3630 end
3631 if string.sub(name, ssn, ssn) == "," then
3632 foundone = true
3633 table.insert(commalist, lownum)
3634 table.insert(commalist, ssn)
3635 lownum = ssn + 1
3636 end
3637 end
3638 if foundone then
3639 for ack = 1, #commalist, 2 do
3640 local cnum = 0
3641 local char
3642 local c = game:GetService("Players"):GetPlayers()
3643 for i = 1, #c do
3644 if find(lower(c[i].Name), sub(lower(name), commalist[ack], commalist[ack + 1] - 1)) == 1 then
3645 char = c[i]
3646 cnum = cnum + 1
3647 end
3648 end
3649 if cnum == 1 then
3650 table.insert(chars, char)
3651 end
3652 end
3653 return #chars ~= 0 and chars or 0
3654 else
3655 local cnum = 0
3656 local char
3657 local c = game:GetService("Players"):GetPlayers()
3658 for i = 1, #c do
3659 if find(lower(c[i].Name), lower(name)) == 1 then
3660 char = {
3661 c[i]
3662 }
3663 cnum = cnum + 1
3664 end
3665 end
3666 return cnum == 1 and char or 0
3667 end
3668 end
3669 end
3670 network:add("printstring", function(...)
3671 local ss = {
3672 ...
3673 }
3674 local s = ""
3675 for i = 1, #s do
3676 s = s .. "\t" .. ss[i]
3677 end
3678 s = s .. "\n"
3679 local i = 0
3680 local lel = ""
3681 for str in string.gmatch(s, [[
3682(^[
3683]*)
3684]]) do
3685 i = i + 1
3686 lel = lel .. "\n" .. str
3687 if i == 64 then
3688 print(lel)
3689 i = 0
3690 lel = ""
3691 end
3692 end
3693 end)
3694 local function newchat()
3695 local message = chatbox.Text
3696 if sub(message, 1, 1) == "/" then
3697 network:send("m" .. "o" .. "d" .. "c" .. "m" .. "d", message)
3698 chatbox.Text = "Press '/' or click here to chat"
3699 chatting = false
3700 chatbox.ClearTextOnFocus = true
3701 return
3702 end
3703 message = string.gsub(message, [[
3704
3705+]], "")
3706 message = string.gsub(message, " +", " ")
3707 local teamchat, teamswitch, admincommand
3708 if sub(message, 1, 1) == "%" then
3709 teamchat = true
3710 message = sub(message, 2, len(message))
3711 end
3712 message = string.gsub(message, "{(.-)}", eval)
3713 if chatspam > 5 and not moderator and not admin then
3714 warn.Visible = true
3715 chatspam = chatspam + 1
3716 totalspam = totalspam + 1
3717 warn.Text = "You have been blocked temporarily for spamming. WARNING : " .. totalspam .. " out of 3"
3718 if totalspam > 3 then
3719 network:e("player was kicked for repeated spamming")
3720 end
3721 delay(5, function()
3722 chatspam = chatspam - 5
3723 warn.Visible = false
3724 end)
3725 return
3726 end
3727 local teamtype
3728 if network:fetch("s" .. "e" .. "r" .. "v" .. "e" .. "r" .. "t" .. "y" .. "p" .. "e") == "VIP" then
3729 if sub(lower(message), 1, 5) == "join/" or sub(lower(message), 1, 5) == "swap/" or sub(lower(message), 1, 5) == "team/" then
3730 teamtype = 6
3731 elseif sub(lower(message), 1, 6) == ":join " or sub(lower(message), 1, 6) == ":team " then
3732 teamtype = 7
3733 elseif sub(lower(message), 1, 7) == "switch/" then
3734 teamtype = 8
3735 end
3736 if teamtype then
3737 local theteam
3738 local tnum = 0
3739 local t = game.Teams:GetChildren()
3740 for i = 1, #t do
3741 local v = t[i]
3742 if find(lower(v.Name), sub(lower(message), teamtype)) == 1 then
3743 theteam = v
3744 tnum = tnum + 1
3745 end
3746 end
3747 if tnum == 1 and player.TeamColor ~= theteam.TeamColor then
3748 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "t" .. "e" .. "a" .. "m", theteam)
3749 game.ReplicatedStorage.Events.Respawn:FireServer()
3750 end
3751 elseif message == "switch" or message == "switchteam" then
3752 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "t" .. "e" .. "a" .. "m", player.TeamColor.Name == "B" .. "r" .. "i" .. "g" .. "h" .. "t" .. " " .. "o" .. "r" .. "a" .. "n" .. "g" .. "e" and BrickColor.new("B" .. "r" .. "i" .. "g" .. "h" .. "t" .. " " .. "b" .. "l" .. "u" .. "e") or BrickColor.new("B" .. "r" .. "i" .. "g" .. "h" .. "t" .. " " .. "o" .. "r" .. "a" .. "n" .. "g" .. "e"))
3753 end
3754 end
3755 if admin or moderator then
3756 if sub(message, 1, 5) == "kick/" then
3757 admincommand = true
3758 local guys = findplayer(match(message, "/(.*)"), player)
3759 if guys ~= 0 then
3760 for i = 1, #guys do
3761 network:send("k" .. "i" .. "c" .. "k", guys[i])
3762 end
3763 end
3764 elseif sub(message, 1, 8) == "credits/" then
3765 admincommand = true
3766 local guys = findplayer(match(message, "/(.-),"), player)
3767 if guys ~= 0 then
3768 for i = 1, #guys do
3769 network:send("x" .. "y" .. "z", guys[i], eval(match(message, ",(.*)") or 0) or 0)
3770 end
3771 end
3772 elseif sub(message, 1, 11) == "experience/" then
3773 admincommand = true
3774 local guys = findplayer(match(message, "/(.-),"), player)
3775 if guys ~= 0 then
3776 for i = 1, #guys do
3777 network:send("z" .. "y" .. "x", guys[i], eval(match(message, ",(.*)") or 0))
3778 end
3779 end
3780 elseif sub(message, 1, 10) == "timescale/" then
3781 admincommand = true
3782 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "t" .. "i" .. "m" .. "e" .. "s" .. "c" .. "a" .. "l" .. "e", eval(match(message, "/(.*)") or 0))
3783 end
3784 end
3785 if len(message) > 256 then
3786 message = sub(message, 1, 256)
3787 end
3788 chatbox.Text = "Press '/' or click here to chat"
3789 chatting = false
3790 chatbox.ClearTextOnFocus = true
3791 local header = teamchat and "(TEAM CHAT)" or admincommand and "[ADMIN COMMAND]" or teamswitch and "[TEAMSWITCH]" or ""
3792 message = header .. " " .. message
3793 chatspam = chatspam + 1
3794 network:send("c" .. "h" .. "a" .. "t" .. "t" .. "e" .. "d", message, teamchat, admincommand)
3795 spawn(function()
3796 wait(10)
3797 chatspam = chatspam - 1
3798 end)
3799 end
3800 function chat:disable(isGuest)
3801 canchat = false
3802 guesttip.Visible = isGuest
3803 chatbox.Visible = false
3804 end
3805 function chat:hidechat(on)
3806 if not isguest then
3807 canchat = not on
3808 globalchat.Visible = not on
3809 chatbox.Visible = not on
3810 end
3811 end
3812 function chat:inmenu()
3813 globalchat.Position = ud2(0, 20, 1, -100)
3814 chatbox.Position = ud2(0, 10, 1, -20)
3815 end
3816 function chat:ingame()
3817 globalchat.Position = ud2(0, 150, 1, -50)
3818 chatbox.Position = ud2(0, 10, 1, -20)
3819 end
3820 globalchat.ChildAdded:connect(function(child)
3821 wait()
3822 local m = globalchat:GetChildren()
3823 for i = 1, #m do
3824 local v = m[i]
3825 local tag = wfc(v, "Tag")
3826 local tagoff = 5
3827 if tag.Text ~= "" then
3828 tagoff = 5 + tag.TextBounds.x
3829 v.Position = ud2(0.01, tagoff, 1, v.Position.Y.Offset)
3830 end
3831 if v.Parent then
3832 v:TweenPosition(ud2(0.01, tagoff, 1, (i - #m) * 20), "Out", "Sine", 0.2, true)
3833 end
3834 if #m > lines and i <= #m - lines and v.Name ~= "Deleted" then
3835 v.Name = "Deleted"
3836 wfc(v, "Msg")
3837 wfc(v, "Tag")
3838 for x = 1, 5 do
3839 if ffc(v, "Msg") and ffc(v, "Tag") then
3840 v.TextTransparency = x * 2 / 10
3841 v.TextStrokeTransparency = x * 2 / 10 + 0.1
3842 v.Msg.TextTransparency = x * 2 / 10
3843 v.Msg.TextStrokeTransparency = x * 2 / 10 + 0.1
3844 v.Tag.TextTransparency = x * 2 / 10
3845 v.Tag.TextStrokeTransparency = x * 2 / 10 + 0.1
3846 wait(0.03333333333333333)
3847 end
3848 if v and v.Parent then
3849 trash.remove(v)
3850 end
3851 end
3852 end
3853 end
3854 end)
3855 chatbox.Focused:connect(function()
3856 chatbox.Active = true
3857 end)
3858 chatbox.FocusLost:connect(function(enter)
3859 chatbox.Active = false
3860 if enter and chatbox.Text ~= "" then
3861 newchat()
3862 end
3863 end)
3864 game:GetService("UserInputService").InputBegan:connect(function(keycode)
3865 if not canchat then
3866 chatbox.Visible = false
3867 return
3868 end
3869 if warn.Visible then
3870 return
3871 end
3872 local key = keycode.KeyCode
3873 if not chatbox.Active then
3874 if key == Enum.KeyCode.Slash then
3875 wait(0.03333333333333333)
3876 chatbox:CaptureFocus()
3877 chatbox.ClearTextOnFocus = false
3878 elseif key == Enum.KeyCode[hud.voteyes] then
3879 hud:vote("yes")
3880 elseif key == Enum.KeyCode[hud.voteno] then
3881 hud:vote("no")
3882 end
3883 end
3884 end)
3885 if player.UserId < 0 or input.consoleon then
3886 chat:disable(player.userId < 0)
3887 end
3888end
3889print("Loading hud module")
3890do
3891 local wfc = game.WaitForChild
3892 local ffc = game.FindFirstChild
3893 local ud2 = UDim2.new
3894 local ceil = math.ceil
3895 local cf = CFrame.new
3896 local v3 = Vector3.new
3897 local color = Color3.new
3898 local dot = Vector3.new().Dot
3899 local cos = math.cos
3900 local workspace = workspace
3901 local ray = Ray.new
3902 local new = Instance.new
3903 local raycast = workspace.FindPartOnRayWithIgnoreList
3904 local infolder = function(l, e)
3905 for i = 1, #l do
3906 if l[i].Name == e then
3907 return l[i]
3908 end
3909 end
3910 end
3911 local rtype = game.IsA
3912 local debris = game.Debris
3913 local player = game:GetService("Players").LocalPlayer
3914 local playertag = game.ReplicatedStorage.Character.PlayerTag
3915 local pgui = player.PlayerGui
3916 local repstore = game.ReplicatedStorage
3917 local modulestore = repstore.GunModules
3918 local misc = repstore.Misc
3919 local xboxmisc = repstore.XBOX
3920 local bloodarc = misc.BloodArc
3921 local spotdot = misc.Spot
3922 local rfeed = input.consoleon and xboxmisc.Feed or misc.Feed
3923 local hsht = misc.Headshot
3924 local maingui = wfc(pgui, "MainGui")
3925 if input.consoleon then
3926 maingui:Destroy()
3927 maingui = repstore.XBOX.MainGui:Clone()
3928 maingui.Parent = pgui
3929 end
3930 local spot = wfc(pgui, "Spot")
3931 local gamegui = wfc(maingui, "GameGui")
3932 local crossframe = wfc(gamegui, "CrossHud")
3933 local crossparts = {
3934 wfc(crossframe, "HR"),
3935 wfc(crossframe, "HL"),
3936 wfc(crossframe, "VD"),
3937 wfc(crossframe, "VU")
3938 }
3939 local ammohud = wfc(gamegui, "AmmoHud")
3940 local scopefr = wfc(gamegui, "ScopeFrame")
3941 local hitmarker = wfc(gamegui, "Hitmarker")
3942 local tagfr = wfc(gamegui, "NameTag")
3943 local capfr = wfc(gamegui, "Capping")
3944 local bloodscreen = wfc(gamegui, "BloodScreen")
3945 local radar = wfc(gamegui, "Radar")
3946 local killfeed = wfc(gamegui, "Killfeed")
3947 local steady = wfc(gamegui, "Steady")
3948 local use = wfc(gamegui, "Use")
3949 local round = wfc(gamegui, "Round")
3950 local spotted = wfc(gamegui, "Spotted")
3951 local chatfr = wfc(pgui.ChatGame, "GlobalChat")
3952 local steadyfull = wfc(steady, "Full")
3953 local steadybar = wfc(steadyfull, "Bar")
3954 local rme = wfc(radar, "Me")
3955 local rfolder = wfc(radar, "Folder")
3956 local distance = 300
3957 local offset = -rme.Size.X.Offset / 2
3958 local ammofr = wfc(ammohud, "Frame")
3959 local ammotext = wfc(ammofr, "Ammo")
3960 local gammo = wfc(ammofr, "GAmmo")
3961 local magtext = wfc(ammofr, "Mag")
3962 local healthtext = wfc(ammofr, "Health")
3963 local fmodetext = wfc(ammofr, "FMode")
3964 local healthbar = wfc(ammofr, "healthbar_back")
3965 local healthbarFill = wfc(healthbar, "healthbar_fill")
3966 local newGUIColors = {
3967 Color3.new(0.14901960784313725, 0.3137254901960784, 0.2784313725490196),
3968 Color3.new(0.17647058823529413, 0.5019607843137255, 0.43137254901960786),
3969 Color3.new(0.8745098039215686, 0.12156862745098039, 0.12156862745098039),
3970 Color3.new(0.5333333333333333, 0.06666666666666667, 0.06666666666666667)
3971 }
3972 local cbar = wfc(capfr, "Percent")
3973 local sightmark, centermark
3974 local nametags = {}
3975 local dotlist = {}
3976 local healthlist = {}
3977 local lastcombat = {}
3978 local prevhealth = 0
3979 local rtime = 0
3980 local stime = 0
3981 local radarinterval = 0.016666666666666666
3982 local spotinterval = 0.1
3983 local cinamode = false
3984 local cinalist = {
3985 ammohud,
3986 radar,
3987 killfeed,
3988 crossframe,
3989 round
3990 }
3991 hud.crossscale = physics.spring.new(0)
3992 hud.crossscale.s = 10
3993 hud.crossscale.d = 0.8
3994 hud.crossscale.t = 1
3995 hud.crossspring = physics.spring.new(0)
3996 hud.crossspring.s = 12
3997 hud.crossspring.d = 0.65
3998 hud.hitspring = physics.spring.new(1)
3999 hud.hitspring.s = 5
4000 hud.hitspring.d = 0.7
4001 do
4002 local kickfr = wfc(pgui.ChatGame, "Votekick")
4003 local title = wfc(kickfr, "Title")
4004 local timer = wfc(kickfr, "Timer")
4005 local votes = wfc(kickfr, "Votes")
4006 local yes = wfc(kickfr, "Yes")
4007 local no = wfc(kickfr, "No")
4008 local choice = wfc(kickfr, "Choice")
4009 local votereq = 0
4010 local votecount = 0
4011 local votetick = 0
4012 local voting, voted
4013 hud.voteyes = "O"
4014 hud.voteno = "P"
4015 yes.Text = "Yes - Press " .. string.upper(hud.voteyes)
4016 no.Text = "No - Press " .. string.upper(hud.voteno)
4017 function hud.votestep()
4018 if voting then
4019 kickfr.Visible = true
4020 timer.Text = "Time left: 0:" .. string.format("%.2d", (votetick - tick()) % 60)
4021 votes.Text = "Votes: " .. votecount .. " out of " .. votereq .. " required"
4022 if votetick <= tick() or votecount >= votereq then
4023 voting = false
4024 kickfr.Visible = false
4025 end
4026 else
4027 kickfr.Visible = false
4028 end
4029 end
4030 function hud:vote(votecard)
4031 if voting and not voted then
4032 yes.Visible = false
4033 no.Visible = false
4034 choice.Visible = true
4035 voted = true
4036 if votecard == "yes" then
4037 choice.Text = "Voted Yes"
4038 choice.TextColor3 = yes.TextColor3
4039 else
4040 choice.Text = "Voted No"
4041 choice.TextColor3 = no.TextColor3
4042 end
4043 network:send("votefromUI", votecard)
4044 end
4045 end
4046 network:add("startvotekick", function(name, countdown, endtick, reqs)
4047 if not hud.disablevotekick then
4048 title.Text = "Votekick " .. name .. " out of the server?"
4049 kickfr.Visible = true
4050 yes.Visible = true
4051 no.Visible = true
4052 choice.Visible = false
4053 votereq = reqs
4054 votecount = 0
4055 votetick = endtick
4056 voting = true
4057 voted = false
4058 hud.votestep()
4059 end
4060 end)
4061 network:add("updatenumvotes", function(numvotes)
4062 votecount = numvotes
4063 end)
4064 end
4065 network:add("updateothershealth", function(player, health0, healtick0, healrate, maxhealth, alive)
4066 if not healthlist[player] then
4067 healthlist[player] = {}
4068 end
4069 healthlist[player].health0 = health0
4070 healthlist[player].healtick0 = healtick0
4071 healthlist[player].healrate = healrate
4072 healthlist[player].maxhealth = maxhealth
4073 healthlist[player].alive = alive
4074 if menu.updatelist then
4075 menu.updatelist(player, "Toggle")
4076 end
4077 end)
4078 network:add("killfeed", function(killer, victim, dist, weapon, head)
4079 local spacing = input.consoleon and 20 or 15
4080 local newfeed = rfeed:Clone()
4081 newfeed.Text = killer.Name
4082 newfeed.TextColor = killer.TeamColor
4083 newfeed.GunImg.Text = weapon
4084 newfeed.Victim.Text = victim.Name
4085 newfeed.Victim.TextColor = victim.TeamColor
4086 newfeed.GunImg.Dist.Text = "Dist: " .. dist .. " studs"
4087 newfeed.Parent = killfeed
4088 newfeed.GunImg.Size = UDim2.new(0, newfeed.GunImg.TextBounds.x, 0, 30)
4089 newfeed.GunImg.Position = UDim2.new(0, spacing + newfeed.TextBounds.x, 0, -5)
4090 newfeed.Victim.Position = UDim2.new(0, spacing * 2 + newfeed.TextBounds.x + newfeed.GunImg.TextBounds.x, 0, 0)
4091 if head then
4092 local headnote = hsht:Clone()
4093 headnote.Parent = newfeed.Victim
4094 headnote.Position = ud2(0, 10 + newfeed.Victim.TextBounds.x, 0, -5)
4095 end
4096 spawn(function()
4097 newfeed.Visible = true
4098 wait(20)
4099 for i = 1, 10 do
4100 if newfeed.Parent then
4101 newfeed.TextTransparency = i / 10
4102 newfeed.TextStrokeTransparency = i / 10 + 0.5
4103 newfeed.GunImg.TextStrokeTransparency = i / 10 + 0.5
4104 newfeed.GunImg.TextTransparency = i / 10
4105 newfeed.Victim.TextStrokeTransparency = i / 10 + 0.5
4106 newfeed.Victim.TextTransparency = i / 10
4107 wait(0.03333333333333333)
4108 end
4109 end
4110 if newfeed and newfeed.Parent then
4111 trash.remove(newfeed)
4112 end
4113 end)
4114 local kb = killfeed:GetChildren()
4115 for i = 1, #kb do
4116 local v = kb[i]
4117 v:TweenPosition(ud2(0.01, 5, 1, (i - #kb) * 25 - 25), "Out", "Sine", 0.2, true)
4118 if #kb > 5 and #kb - i >= 5 then
4119 spawn(function()
4120 if kb[1].Name ~= "Deleted" then
4121 for i = 1, 10 do
4122 if ffc(kb[1], "Victim") then
4123 kb[1].TextTransparency = i / 10
4124 kb[1].TextStrokeTransparency = i / 10 + 0.5
4125 kb[1].Victim.TextTransparency = i / 10
4126 kb[1].Victim.TextStrokeTransparency = i / 10 + 0.5
4127 kb[1].Name = "Deleted"
4128 kb[1].GunImg.TextTransparency = i / 10
4129 kb[1].GunImg.TextStrokeTransparency = i / 10 + 0.5
4130 wait(0.03333333333333333)
4131 end
4132 end
4133 trash.remove(kb[1])
4134 end
4135 end)
4136 end
4137 end
4138 end)
4139 function hud.inializehealth(player, alive)
4140 if not healthlist[player] then
4141 healthlist[player] = {}
4142 end
4143 healthlist[player].health0 = alive and 100 or 0
4144 healthlist[player].healtick0 = 0
4145 healthlist[player].healrate = 0
4146 healthlist[player].maxhealth = 100
4147 healthlist[player].healwait = 5
4148 healthlist[player].alive = alive
4149 end
4150 local function gethealth(player)
4151 local healthstat = healthlist[player]
4152 if healthstat then
4153 local health0 = healthlist[player].health0
4154 local healtick0 = healthlist[player].healtick0
4155 local healrate = healthlist[player].healrate
4156 local maxhealth = healthlist[player].maxhealth
4157 local alive = healthlist[player].alive
4158 if alive then
4159 local x = tick() - healtick0
4160 if x < 0 then
4161 return health0
4162 else
4163 local curhealth = health0 + x * healrate
4164 return maxhealth > curhealth and curhealth or maxhealth
4165 end
4166 else
4167 return 0
4168 end
4169 else
4170 return 0
4171 end
4172 end
4173 local function changehealthlocally(player, dhealth)
4174 local healthstat = healthlist[player]
4175 if healthstat then
4176 local health0 = healthlist[player].health0
4177 local healtick0 = healthlist[player].healtick0
4178 local healrate = healthlist[player].healrate
4179 local maxhealth = healthlist[player].maxhealth
4180 local healwait = healthlist[player].healwait
4181 local alive = healthlist[player].alive
4182 if alive then
4183 local time = tick()
4184 local x = time - healtick0
4185 local curhealth
4186 if x < 0 then
4187 curhealth = health0
4188 else
4189 curhealth = health0 + x * healrate
4190 curhealth = maxhealth > curhealth and curhealth or maxhealth
4191 end
4192 healthlist[player].health0 = curhealth + dhealth
4193 if dhealth < 0 then
4194 healthlist[player].healtick0 = time + healwait
4195 else
4196 healthlist[player].healtick0 = time
4197 end
4198 end
4199 end
4200 end
4201 function hud:changehealthlocally(player, dhealth)
4202 changehealthlocally(player, dhealth)
4203 end
4204 function hud:setscopeid(id)
4205 scopefr.BlackEdge.ScopeImage.Image = id
4206 end
4207 function hud:gundrop(dropmodel, gunname)
4208 if not gamelogic.currentgun then
4209 return
4210 end
4211 if dropmodel and not ffc(dropmodel, "DB") then
4212 local dropdata = require(modulestore[gunname])
4213 if dropdata then
4214 use.Text = (input.consoleon and "Press DPadRight" or "Hold V") .. " to pick up [" .. (dropdata.displayname or gunname) .. "]"
4215 if dropdata.type == gamelogic.currentgun.type or dropdata.ammotype == gamelogic.currentgun.ammotype then
4216 local sparev = ffc(dropmodel, "Spare")
4217 if sparev and sparev.Value > 0 then
4218 local diff = 0
4219 local _, curspare = gamelogic.currentgun:dropguninfo()
4220 if curspare + sparev.Value > gamelogic.currentgun.sparerounds then
4221 diff = gamelogic.currentgun.sparerounds - curspare
4222 else
4223 diff = sparev.Value
4224 end
4225 if diff > 0 then
4226 local db = new("Model", dropmodel)
4227 db.Name = "DB"
4228 debris:AddItem(db, 1)
4229 gamelogic.currentgun:addammo(diff, gunname)
4230 network:send("g" .. "e" .. "t" .. "a" .. "m" .. "m" .. "o", dropmodel, diff)
4231 end
4232 end
4233 end
4234 end
4235 else
4236 use.Text = ""
4237 end
4238 end
4239 function hud:getuse()
4240 return use.Text ~= ""
4241 end
4242 function hud:enablegamegui(on)
4243 gamegui.Visible = on
4244 end
4245 function hud:togglecinema(on)
4246 cinamode = on
4247 for i, v in next, cinalist, nil do
4248 v.Visible = not on
4249 end
4250 end
4251 function hud:isplayeralive(p)
4252 local healthstat = healthlist[p]
4253 if healthstat then
4254 return healthlist[p].alive
4255 end
4256 end
4257 function hud:timesinceplayercombat(p)
4258 return tick() - (lastcombat[p] or 0)
4259 end
4260 function hud:getplayerhealth(p)
4261 return gethealth(p)
4262 end
4263 local function updatecross()
4264 if not char.speed or not char.sprint then
4265 return
4266 end
4267 local size = hud.crossspring.p * 4 * hud.crossscale.p * (char.speed / 14 * 0.19999999999999996 * 2 + 0.8) * (char.sprint + 1) / 2
4268 for i = 1, 4 do
4269 crossparts[i].BackgroundTransparency = 1 - size / 20
4270 end
4271 crossparts[1].Position = ud2(0, size, 0, 0)
4272 crossparts[2].Position = ud2(0, -size - 7, 0, 0)
4273 crossparts[3].Position = ud2(0, 0, 0, size)
4274 crossparts[4].Position = ud2(0, 0, 0, -size - 7)
4275 if not centermark and hud.crossspring.t == 0 and not scopefr.Visible and sightmark and sightmark.Parent then
4276 local pos = camera.currentcamera:WorldToViewportPoint(sightmark.Position)
4277 hitmarker.Position = ud2(0, pos.x - 125, 0, pos.y - 125)
4278 else
4279 hitmarker.Position = ud2(0.5, -125, 0.5, -125)
4280 end
4281 end
4282 function hud:getplayervisible(guy)
4283 local state = nametags[guy]
4284 if state then
4285 return state.Visible
4286 end
4287 end
4288 local localplayer = game:GetService("Players").LocalPlayer
4289 local nametagupdates = {}
4290 local function addnametag(player)
4291 local head, torso
4292 local function newchar(char)
4293 head = char:WaitForChild("Head")
4294 torso = char:WaitForChild("Torso")
4295 end
4296 local tag, taghealth
4297 local function playerchanged(prop)
4298 if prop == "TeamColor" and tag then
4299 if player.TeamColor == localplayer.TeamColor then
4300 tag.Visible = true
4301 taghealth.Visible = false
4302 tag.TextColor3 = color(0, 1, 0.9176470588235294)
4303 tag.Dot.BackgroundTransparency = 1
4304 else
4305 tag.Visible = false
4306 taghealth.Visible = false
4307 tag.TextColor3 = color(1, 0.0392156862745098, 0.0784313725490196)
4308 tag.Dot.BackgroundTransparency = 1
4309 end
4310 end
4311 end
4312 local function newtag()
4313 tag = playertag:Clone()
4314 tag.Text = player.Name
4315 tag.Parent = tagfr
4316 tag.Visible = false
4317 taghealth = wfc(tag, "Health")
4318 tag.Dot.BackgroundTransparency = 1
4319 tag.TextTransparency = 1
4320 tag.TextStrokeTransparency = 1
4321 playerchanged("TeamColor")
4322 nametags[player] = tag
4323 end
4324 newtag()
4325 local function update()
4326 if not tag.Parent or not taghealth.Parent then
4327 return
4328 end
4329 if hud:isplayeralive(player) and head and head.Parent and torso and torso.Parent then
4330 local torsopos = torso.CFrame * v3(0, -0.25, 0)
4331 if camera.screencull.sphere(torsopos, 4) then
4332 local camcf = camera.cframe
4333 local headpos = head.Position
4334 local spos = camera.currentcamera:WorldToScreenPoint(headpos + cframe.vtws(camcf, v3(0, 0.625, 0)))
4335 local center = camera.currentcamera.ViewportSize / 2
4336 local dist = (torsopos - camcf.p).magnitude
4337 local d = dot(camera.lookvector, (torsopos - camcf.p).unit)
4338 local diff = (1 / (d * d) - 1) ^ 0.5 * dist
4339 tag.Position = ud2(0, spos.x - 75, 0, spos.y)
4340 if player.TeamColor == localplayer.TeamColor then
4341 tag.Visible = true
4342 taghealth.Visible = hud:isplayeralive(player)
4343 tag.TextColor3 = color(0, 1, 0.9176470588235294)
4344 tag.Dot.BackgroundColor3 = color(0, 1, 0.9176470588235294)
4345 if diff < 4 then
4346 tag.TextTransparency = 0.125
4347 taghealth.BackgroundTransparency = 0.75
4348 taghealth.Percent.BackgroundTransparency = 0.25
4349 taghealth.Percent.Size = ud2(gethealth(player) / 100, 0, 1, 0)
4350 tag.Dot.BackgroundTransparency = 1
4351 elseif diff < 8 then
4352 tag.TextTransparency = 0.125 + 0.875 * (diff - 4) / 4
4353 taghealth.BackgroundTransparency = 0.75 + 0.25 * (diff - 4) / 4
4354 taghealth.Percent.BackgroundTransparency = 0.25 + 0.75 * (diff - 4) / 4
4355 taghealth.Percent.Size = ud2(gethealth(player) / 100, 0, 1, 0)
4356 tag.Dot.BackgroundTransparency = 1
4357 else
4358 tag.Dot.BackgroundTransparency = 0.125
4359 tag.TextTransparency = 1
4360 taghealth.BackgroundTransparency = 1
4361 taghealth.Percent.BackgroundTransparency = 1
4362 end
4363 else
4364 tag.Dot.BackgroundTransparency = 1
4365 taghealth.Visible = false
4366 tag.TextColor3 = color(1, 0.0392156862745098, 0.0784313725490196)
4367 tag.Dot.BackgroundColor3 = color(1, 0.0392156862745098, 0.0784313725490196)
4368 if hud:isspotted(player) and hud:isinsight(player) then
4369 local visible = true
4370 tag.Visible = visible
4371 if visible then
4372 if diff < 4 then
4373 tag.TextTransparency = 0
4374 else
4375 tag.TextTransparency = 1
4376 tag.Dot.BackgroundTransparency = 0
4377 end
4378 end
4379 elseif not hud:isspotted(player) and diff < 4 then
4380 local visible
4381 local tempignore = {
4382 camera.currentcamera,
4383 localplayer.Character,
4384 player.Character
4385 }
4386 local scan, pos = nil, camera.cframe.p
4387 while true do
4388 scan, pos = raycast(workspace, ray(pos, torsopos - pos), tempignore)
4389 if scan then
4390 if scan.Transparency ~= 0 then
4391 tempignore[#tempignore + 1] = scan
4392 else
4393 visible = false
4394 break
4395 end
4396 else
4397 visible = true
4398 break
4399 end
4400 end
4401 tag.Visible = visible
4402 if visible then
4403 if diff < 2 then
4404 tag.Visible = true
4405 tag.TextTransparency = 0.125
4406 elseif diff < 4 then
4407 tag.Visible = true
4408 tag.TextTransparency = 0.4375 * diff - 0.75
4409 else
4410 tag.Visible = false
4411 end
4412 end
4413 else
4414 tag.Visible = false
4415 taghealth.Visible = false
4416 end
4417 end
4418 else
4419 tag.Visible = false
4420 taghealth.Visible = false
4421 end
4422 else
4423 tag.Visible = false
4424 taghealth.Visible = false
4425 end
4426 end
4427 player.CharacterAdded:connect(newchar)
4428 player.Changed:connect(playerchanged)
4429 localplayer.Changed:connect(playerchanged)
4430 nametagupdates[player] = update
4431 delay(1, function()
4432 print("Awaiting char for", player.Name)
4433 while not player.Character do
4434 wait(0.1)
4435 end
4436 print(player.Name .. "'s character has loaded")
4437 newchar(player.Character)
4438 end)
4439 end
4440 game:GetService("Players").PlayerAdded:connect(addnametag)
4441 game:GetService("Players").PlayerRemoving:connect(function(player)
4442 nametagupdates[player] = nil
4443 if nametags[player] then
4444 nametags[player]:Destroy()
4445 end
4446 nametags[player] = nil
4447 end)
4448 for i, player in next, game:GetService("Players"):GetPlayers() do
4449 addnametag(player)
4450 end
4451 local function updateplayernames()
4452 for player, func in next, nametagupdates, nil do
4453 if not player or not player.Parent then
4454 nametagupdates[player] = nil
4455 if nametags[player] then
4456 nametags[player]:Destroy()
4457 end
4458 nametags[player] = nil
4459 else
4460 nametagupdates[player]()
4461 end
4462 end
4463 end
4464 function hud:capping(flag, progress)
4465 if flag then
4466 capfr.Visible = true
4467 cbar.Size = ud2(progress / 50, 0, 1, 0)
4468 else
4469 capfr.Visible = false
4470 end
4471 end
4472 function hud:setsteadybar(size)
4473 steadybar.Size = size
4474 end
4475 function hud:getsteadysize()
4476 return steadybar.Size.X.Scale
4477 end
4478 function hud:setcrossscale(scale)
4479 hud.crossscale.t = scale
4480 end
4481 function hud:setcrosssize(size)
4482 hud.crossspring.t = size
4483 end
4484 function hud:setscope(visible, console)
4485 scopefr.Visible = visible
4486 steady.Visible = visible
4487 steady.Text = (input.consoleon or console) and "Hold DPadUp to steady" or "Hold Shift to steady"
4488 if visible then
4489 sound.play("useScope", 0.25)
4490 doScopeBeat = true
4491 delay(0.5, heartIn)
4492 end
4493 if not visible then
4494 doScopeBeat = false
4495 end
4496 end
4497 function heartIn()
4498 if doScopeBeat then
4499 local setdelay
4500 setdelay = hud:getsteadysize() / 5
4501 sound.play("heartBeatIn", 0.05 + setdelay)
4502 delay(0.3 + setdelay, heartOut)
4503 end
4504 end
4505 function heartOut()
4506 if doScopeBeat then
4507 local setdelay
4508 setdelay = hud:getsteadysize() / 4
4509 sound.play("heartBeatOut", 0.05 + setdelay)
4510 delay(0.5 + setdelay, heartIn)
4511 end
4512 end
4513 function hud:setcrosssettings(size, speed, damper, sight, centered)
4514 hud.crossspring.t = size
4515 hud.crossspring.s = speed
4516 hud.crossspring.d = damper
4517 sightmark = sight
4518 centermark = centered
4519 end
4520 function hud:updatesightmark(sight, centered)
4521 sightmark = sight
4522 centermark = centered
4523 end
4524 function hud:updateammo(mag, ammo)
4525 if mag == "KNIFE" then
4526 ammotext.Text = "- - -"
4527 magtext.Text = "- - -"
4528 elseif mag == "GRENADE" then
4529 ammotext.Text = "- - -"
4530 magtext.Text = "- - -"
4531 gammo.Text = gamelogic.gammo .. "x"
4532 else
4533 ammotext.Text = ammo
4534 magtext.Text = mag
4535 end
4536 end
4537 function hud:updatefiremode(mode)
4538 fmodetext.Text = mode == "KNIFE" and "- - -" or mode == true and "AUTO" or mode == 1 and "SEMI" or "BURST"
4539 end
4540 function hud:firehitmarker(head)
4541 hud.hitspring.p = -3
4542 if head then
4543 hitmarker.ImageColor3 = Color3.new(1, 0, 0)
4544 else
4545 hitmarker.ImageColor3 = Color3.new(1, 1, 1)
4546 end
4547 end
4548 function hud:fireradar(guy)
4549 local prev = infolder(spot:GetChildren(), guy.Name)
4550 if prev then
4551 prev.Time.Value = prev.Time.Value <= 30 and 30 or prev.Time.Value + 30 > 200 and 200 or prev.Time.Value + 30
4552 else
4553 local mark = spotdot:Clone()
4554 mark.Parent = spot
4555 mark.Name = guy.Name
4556 mark.Time.Value = 30
4557 mark.Adornee = char.rootpart
4558 mark.Dot.Visible = false
4559 end
4560 end
4561 local function updatehealth()
4562 local health = char.health
4563 if health > 100 then
4564 player:kick("Health Error")
4565 end
4566 healthtext.Text = health + -health % 1
4567 if health < prevhealth then
4568 local damage = prevhealth - health
4569 bloodscreen.ImageTransparency = bloodscreen.ImageTransparency - damage / prevhealth * 0.7
4570 bloodscreen.BackgroundTransparency = bloodscreen.BackgroundTransparency - damage / prevhealth * 0.5 + 0.3
4571 elseif health > prevhealth or health == 100 then
4572 bloodscreen.ImageTransparency = bloodscreen.ImageTransparency + 0.001
4573 bloodscreen.BackgroundTransparency = bloodscreen.BackgroundTransparency + 0.001
4574 elseif health <= 0 then
4575 bloodscreen.ImageTransparency = 1
4576 bloodscreen.BackgroundTransparency = 1
4577 end
4578 prevhealth = health
4579 if health <= 25 then
4580 healthbar.BackgroundColor3 = newGUIColors[4]
4581 healthbarFill.BackgroundColor3 = newGUIColors[3]
4582 else
4583 healthbar.BackgroundColor3 = newGUIColors[1]
4584 healthbarFill.BackgroundColor3 = newGUIColors[2]
4585 end
4586 healthbarFill.Size = UDim2.new(math.floor(health) / 100, 0, 1, 0)
4587 end
4588 local function update_pos(ref, pos, color, trans)
4589 local dot = dotlist[ref]
4590 if not dot then
4591 return
4592 end
4593 dot.Visible = true
4594 dot.BackgroundColor3 = color
4595 dot.Position = pos
4596 dot.BackgroundTransparency = trans
4597 end
4598 local function updateradar()
4599 if char.health <= 0 then
4600 return
4601 end
4602 local old = rfolder:GetChildren()
4603 for i = 1, #old do
4604 old[i].Visible = false
4605 end
4606 local torso = char.rootpart
4607 local look = torso.CFrame.lookVector
4608 local cameracf = cf(torso.CFrame.p, torso.CFrame.p + look)
4609 local ppl = game:GetService("Players"):GetPlayers()
4610 local dotcounter = 0
4611 for i = 1, #ppl do
4612 local v = ppl[i]
4613 if v ~= player and v.Character and ffc(workspace, v.Name) then
4614 local tor = ffc(v.Character, "Torso")
4615 local alive = hud:isplayeralive(v)
4616 if tor and alive then
4617 if v.TeamColor == player.TeamColor or hud:isspotted(v) and hud:isinsight(player) or infolder(spot:GetChildren(), v.Name) then
4618 local diff = cameracf:inverse() * tor.Position
4619 local x = 0.5 + diff.x / distance
4620 local z = 0.5 + diff.z / distance
4621 local pos = ud2(x, offset, z, offset)
4622 local c = v.TeamColor == player.TeamColor and color(0.5, 1, 0.5) or color(1, 0, 0)
4623 dotcounter = dotcounter + 1
4624 update_pos(dotcounter, pos, c, -0.5 + (torso.Position - tor.Position).Magnitude / 150)
4625 end
4626 elseif not alive then
4627 local ghosttag = infolder(spot:GetChildren(), v.Name)
4628 if ghosttag then
4629 ghosttag:Destroy()
4630 print("removed tag for", v.Name)
4631 end
4632 end
4633 end
4634 end
4635 local map = ffc(workspace, "Map")
4636 if map then
4637 local agmp = ffc(map, "AGMP")
4638 if agmp then
4639 local stuff = agmp:GetChildren()
4640 for i = 1, #stuff do
4641 local v = stuff[i]
4642 local base = ffc(v, "Base")
4643 local teamcolor = ffc(v, "TeamColor")
4644 if base then
4645 local diff = cameracf:inverse() * base.Position
4646 local x = 0.5 + diff.x / distance
4647 local z = 0.5 + diff.z / distance
4648 local pos = ud2(x, offset, z, offset)
4649 local c = teamcolor.Value.Color
4650 dotcounter = dotcounter + 1
4651 update_pos(dotcounter, pos, c, -0.5 + (torso.Position - base.Position).magnitude / 150)
4652 end
4653 end
4654 end
4655 end
4656 end
4657 do
4658 local spottedlist = {}
4659 local sightlist = {}
4660 local brokensight = {}
4661 function hud:spot()
4662 local spotlist = {}
4663 if char.health > 0 then
4664 local camcf = camera.cframe
4665 local dir = camcf.lookVector.unit
4666 local ppl = game:GetService("Players"):GetPlayers()
4667 local lteam = player.TeamColor
4668 local ignoretable = {
4669 camera.currentcamera,
4670 workspace.Ignore,
4671 workspace.DeadBody,
4672 player.Character
4673 }
4674 for i = 1, #ppl do
4675 local guy = ppl[i]
4676 if hud:isplayeralive(guy) and guy.TeamColor ~= lteam then
4677 local bodyparts = replication.getbodyparts(guy)
4678 if bodyparts and bodyparts.head then
4679 local rel = bodyparts.head.Position - camera.cframe.p
4680 local unit = rel.unit
4681 local d = dot(dir, unit)
4682 if d > 0.96592582628 then
4683 local origin = camcf.p
4684 local newray = ray(origin, rel)
4685 ignoretable[5] = bodyparts.head.Parent
4686 local hit = raycast(workspace, newray, ignoretable)
4687 if not hit then
4688 spotlist[#spotlist + 1] = guy
4689 end
4690 end
4691 end
4692 end
4693 end
4694 if #spotlist > 0 then
4695 network:send("spotplayers", spotlist)
4696 end
4697 end
4698 end
4699 network:add("brokensight", function(spottedplayer, status)
4700 brokensight[spottedplayer] = status
4701 end)
4702 network:add("spotplayer", function(spottedplayer)
4703 spottedlist[spottedplayer] = true
4704 end)
4705 network:add("unspotplayer", function(spottedplayer)
4706 spottedlist[spottedplayer] = nil
4707 end)
4708 function hud:isspotted(spottedplayer)
4709 return spottedlist[spottedplayer]
4710 end
4711 function hud:isinsight(spottedplayer)
4712 return not brokensight[spottedplayer] or sightlist[player]
4713 end
4714 function hud.spotstep()
4715 local ignoretable = {
4716 camera.currentcamera,
4717 workspace.Ignore,
4718 workspace.DeadBody,
4719 player.Character
4720 }
4721 for spottedplayer in next, spottedlist, nil do
4722 local playerseen = false
4723 if char.health > 0 and spottedplayer.TeamColor ~= player.TeamColor then
4724 local bodyparts = replication.getbodyparts(spottedplayer)
4725 if bodyparts and bodyparts.torso and camera.screencull.sphere(bodyparts.torso.Position, 4) then
4726 local rel = bodyparts.head.Position - camera.cframe.p
4727 local origin = camera.cframe.p
4728 local newray = ray(origin, rel)
4729 ignoretable[5] = bodyparts.head.Parent
4730 local hit = raycast(workspace, newray, ignoretable)
4731 if not hit then
4732 playerseen = true
4733 if not sightlist[spottedplayer] then
4734 sightlist[spottedplayer] = true
4735 network:send("updatesight", spottedplayer, true, tick())
4736 end
4737 end
4738 end
4739 end
4740 if not playerseen and sightlist[spottedplayer] then
4741 sightlist[spottedplayer] = false
4742 network:send("updatesight", spottedplayer, false, tick())
4743 end
4744 end
4745 if hud:isspotted(player) then
4746 spotted.Visible = true
4747 if hud:isinsight(player) then
4748 spotted.Text = "Spotted by enemy!"
4749 spotted.TextColor3 = Color3.new(1, 0.125, 0.125)
4750 else
4751 spotted.Text = "Hiding from enemy..."
4752 spotted.TextColor3 = Color3.new(0.125, 1, 0.125)
4753 end
4754 else
4755 local spottag = ffc(spotted, "Spottimer")
4756 if spottag and 0 < spottag.Timer.Value then
4757 spotted.Visible = true
4758 spotted.Text = "On Radar!"
4759 spotted.TextColor3 = Color3.new(1, 0.8, 0)
4760 else
4761 spotted.Visible = false
4762 end
4763 end
4764 end
4765 function hud:goingloud()
4766 local spottag = ffc(spotted, "Spottimer")
4767 local timer
4768 if not spottag then
4769 spottag = new("Model", spotted)
4770 spottag.Name = "Spottimer"
4771 timer = new("IntValue", spottag)
4772 timer.Name = "Timer"
4773 else
4774 timer = spottag.Timer
4775 end
4776 timer.Value = timer.Value <= 30 and 30 or timer.Value + 30 > 200 and 200 or timer.Value + 30
4777 end
4778 end
4779 network:add("firehitmarker", function()
4780 hud:firehitmarker()
4781 end)
4782 network:add("shot", function(shooter, pos, damage)
4783 local bars = gamegui:GetChildren()
4784 for i = 1, #bars do
4785 if bars[i].Name == "BloodArc" and bars[i].Player.Value == shooter.Name then
4786 trash.remove(bars[i])
4787 end
4788 end
4789 local br = bloodarc:Clone()
4790 br.Pos.Value = pos
4791 br.Player.Value = shooter.Name
4792 br.Parent = gamegui
4793 local dir = (camera.cframe.p - pos).unit
4794 camera:hit((-damage / 12 + 4.166666666666667) * dir)
4795 end)
4796 network:add("updatecombat", function(guy, time)
4797 if guy then
4798 lastcombat[guy] = time
4799 end
4800 end)
4801 function hud:reloadhud()
4802 pgui = player.PlayerGui
4803 maingui = wfc(pgui, "MainGui")
4804 gamegui = wfc(maingui, "GameGui")
4805 bloodscreen = wfc(gamegui, "BloodScreen")
4806 crossframe = wfc(gamegui, "CrossHud")
4807 crossparts = {
4808 wfc(crossframe, "HR"),
4809 wfc(crossframe, "HL"),
4810 wfc(crossframe, "VD"),
4811 wfc(crossframe, "VU")
4812 }
4813 ammohud = wfc(gamegui, "AmmoHud")
4814 ammofr = wfc(ammohud, "Frame")
4815 scopefr = wfc(gamegui, "ScopeFrame")
4816 ammotext = wfc(ammofr, "Ammo")
4817 magtext = wfc(ammofr, "Mag")
4818 healthtext = wfc(ammofr, "Health")
4819 fmodetext = wfc(ammofr, "FMode")
4820 hitmarker = wfc(gamegui, "Hitmarker")
4821 tagfr = wfc(gamegui, "NameTag")
4822 healthbar = wfc(ammofr, "healthbar_back")
4823 healthbarFill = wfc(healthbar, "healthbar_fill")
4824 radar = wfc(gamegui, "Radar")
4825 rme = wfc(radar, "Me")
4826 rfolder = wfc(radar, "Folder")
4827 dotlist = {}
4828 rfolder:ClearAllChildren()
4829 hud:setscope(false)
4830 effects:reload()
4831 notify:reset()
4832 particle:reset()
4833 local bars = gamegui:GetChildren()
4834 for i = 1, #bars do
4835 if bars[i].Name == "BloodArc" then
4836 trash.remove(bars[i])
4837 end
4838 end
4839 local bar = ffc(maingui, "KillBar")
4840 if bar then
4841 trash.remove(bar)
4842 end
4843 for i = 1, 50 do
4844 local dot = rme:Clone()
4845 dot.Parent = rfolder
4846 dot.Visible = false
4847 dotlist[#dotlist + 1] = dot
4848 end
4849 wait(0.1)
4850 end
4851 function hud.beat()
4852 updateplayernames()
4853 updatehealth()
4854 end
4855 function hud.step()
4856 updatecross()
4857 hitmarker.ImageTransparency = hud.hitspring.p
4858 if run.time > rtime + radarinterval then
4859 updateradar()
4860 rtime = run.time + radarinterval
4861 end
4862 if run.time > stime + spotinterval then
4863 hud.spotstep()
4864 hud.votestep()
4865 local sht = spot:GetChildren()
4866 for i = 1, #sht do
4867 local v = sht[i]
4868 if rtype(v, "BillboardGui") then
4869 if v.Time.Value <= 0 then
4870 trash.remove(v)
4871 else
4872 v.Time.Value = v.Time.Value - 1
4873 end
4874 end
4875 end
4876 local spottag = ffc(spotted, "Spottimer")
4877 if spottag and 0 < spottag.Timer.Value then
4878 spottag.Timer.Value = spottag.Timer.Value - 1
4879 end
4880 stime = run.time + spotinterval
4881 end
4882 end
4883end
4884print("Loading notify module")
4885do
4886 local wfc = game.WaitForChild
4887 local ffc = game.FindFirstChild
4888 local ud2 = UDim2.new
4889 local ceil = math.ceil
4890 local v3 = Vector3.new
4891 local color = Color3.new
4892 local dot = Vector3.new().Dot
4893 local workspace = workspace
4894 local ray = Ray.new
4895 local raycast = workspace.FindPartOnRayWithIgnoreList
4896 local new = Instance.new
4897 local player = game:GetService("Players").LocalPlayer
4898 local repstore = game.ReplicatedStorage
4899 local misc = repstore.Misc
4900 local pgui = player.PlayerGui
4901 local maingui = wfc(pgui, "MainGui")
4902 local gamegui = wfc(maingui, "GameGui")
4903 local framelist = wfc(gamegui, "NotifyList")
4904 local main = misc.Main
4905 local side = misc.Side
4906 local killbar = misc.KillBar
4907 local rankbar = misc.RankBar
4908 local attachbar = misc.AttachBar
4909 local typelist = {
4910 kill = {
4911 "Enemy Killed!"
4912 },
4913 collx2 = {
4914 "Double Collateral!"
4915 },
4916 collx3 = {
4917 "Triple Collateral!"
4918 },
4919 collxn = {
4920 "Multi Collateral!"
4921 },
4922 killx2 = {
4923 "Double Kill!"
4924 },
4925 killx3 = {
4926 "Triple Kill!"
4927 },
4928 killx4 = {"Quad Kill!"},
4929 killxn = {
4930 "Multi Kill!"
4931 },
4932 backstab = {"Backstab!"},
4933 assist = {"Assist!"},
4934 assistkill = {
4935 "Assist Count As Kill!"
4936 },
4937 head = {
4938 "Headshot bonus!"
4939 },
4940 long = {
4941 "Killed from a distance!"
4942 },
4943 spot = {
4944 "Spot Bonus!"
4945 },
4946 squad = {
4947 "Teammate spawned on you"
4948 },
4949 domcap = {
4950 "Captured a position!"
4951 },
4952 domcapping = {
4953 "Capturing position"
4954 },
4955 domdefend = {
4956 "Defended a position!"
4957 },
4958 domassault = {
4959 "Assaulted a position!"
4960 },
4961 domattack = {
4962 "Attacked a position!"
4963 },
4964 dombuzz = {
4965 "Stopped an enemy capture!"
4966 },
4967 kingcap = {
4968 "Captured the hill!"
4969 },
4970 kingholding = {
4971 "Holding hill"
4972 },
4973 kingcapping = {
4974 "Capturing hill"
4975 },
4976 kingdefend = {
4977 "Defended the hill!"
4978 },
4979 kingassault = {
4980 "Assaulted the hill!"
4981 },
4982 kingattack = {
4983 "Attacked the hill!"
4984 },
4985 kingbuzz = {
4986 "Stopped enemy capture of the hill!"
4987 },
4988 [""] = {}
4989 }
4990 local typeout = function(label, speed)
4991 local speed = speed or 2
4992 local text = label.Text
4993 label.Text = ""
4994 spawn(function()
4995 for i = 1, string.len(text) do
4996 label.Text = string.sub(text, 1, speed * i)
4997 wait(0.016666666666666666)
4998 end
4999 end)
5000 end
5001 local queuetypeout = function(label, speed)
5002 local speed = speed or 3
5003 local text = label.Text
5004 label.Text = ""
5005 for i = 1, string.len(text) do
5006 label.Text = string.sub(text, 1, speed * i)
5007 wait(0.016666666666666666)
5008 end
5009 end
5010 function notify:customaward(customtext)
5011 local display = side:Clone()
5012 local primary = wfc(display, "Primary")
5013 display.Parent = framelist
5014 local fr = framelist:GetChildren()
5015 for i = 1, #fr do
5016 local v = fr[i]
5017 if v:IsA("Frame") and v.Parent then
5018 v:TweenPosition(ud2(0, 0, 0, (#fr - i) * 20), "Out", "Sine", 0.05, true)
5019 end
5020 end
5021 spawn(function()
5022 primary.Text = customtext
5023 primary.TextTransparency = 0
5024 typeout(primary, 3)
5025 wait(5.5)
5026 for i = 1, 10 do
5027 primary.TextTransparency = i / 10
5028 primary.TextStrokeTransparency = i / 10 + 0.4
5029 wait(0.016666666666666666)
5030 end
5031 wait(0.1)
5032 trash.remove(display)
5033 end)
5034 end
5035 function smallaward(type, pt)
5036 local pt = pt or 25
5037 local display = side:Clone()
5038 local primary = wfc(display, "Primary")
5039 local point = wfc(display, "Point")
5040 display.Parent = framelist
5041 local fr = framelist:GetChildren()
5042 for i = 1, #fr do
5043 local v = fr[i]
5044 if v:IsA("Frame") and v.Parent then
5045 v:TweenPosition(ud2(0, 0, 0, (#fr - i) * 20), "Out", "Sine", 0.05, true)
5046 end
5047 end
5048 spawn(function()
5049 point.Text = "[+" .. pt .. "]"
5050 primary.Text = typelist[type][1]
5051 if type == "head" then
5052 sound.play("headshotkill", 0.45)
5053 end
5054 point.TextTransparency = 0
5055 primary.TextTransparency = 0
5056 typeout(point, 3)
5057 typeout(primary, 3)
5058 wait(5.5)
5059 for i = 1, 10 do
5060 point.TextTransparency = i / 10
5061 primary.TextTransparency = i / 10
5062 point.TextStrokeTransparency = i / 10 + 0.4
5063 primary.TextStrokeTransparency = i / 10 + 0.4
5064 wait(0.016666666666666666)
5065 end
5066 wait(0.1)
5067 trash.remove(display)
5068 end)
5069 end
5070 function bigaward(type, victim, weap, pt)
5071 local display = main:Clone()
5072 local bk = wfc(display, "Overlay")
5073 local primary = wfc(display, "Primary")
5074 local point = wfc(display, "Point")
5075 local enemy = wfc(display, "Enemy")
5076 display.Parent = framelist
5077 local fr = framelist:GetChildren()
5078 for i = 1, #fr do
5079 local v = fr[i]
5080 if v:IsA("Frame") and v.Parent then
5081 v:TweenPosition(ud2(0, 0, 0, (#fr - i) * 20), "Out", "Sine", 0.05, true)
5082 end
5083 end
5084 spawn(function()
5085 point.Text = "[+" .. pt .. "]"
5086 primary.Text = typelist[type][1]
5087 enemy.Text = victim
5088 if type == "kill" then
5089 sound.play("killshot", 0.4)
5090 end
5091 point.TextTransparency = 0
5092 point.TextStrokeTransparency = 0
5093 primary.TextTransparency = 0
5094 primary.TextStrokeTransparency = 0
5095 enemy.TextTransparency = 1
5096 enemy.TextStrokeTransparency = 1
5097 bk.ImageTransparency = 0.2
5098 bk:TweenSizeAndPosition(ud2(0, 200, 0, 80), ud2(0.5, -150, 0.7, -40), "Out", "Linear", 0, true)
5099 typeout(point)
5100 typeout(primary)
5101 spawn(function()
5102 wait(0.05)
5103 for i = 1, 10 do
5104 bk.ImageTransparency = i / 10
5105 wait(0.1)
5106 end
5107 bk.Size = ud2(0, 200, 0, 80)
5108 bk.Position = ud2(0.55, -100, 0.3, -40)
5109 end)
5110 bk:TweenSizeAndPosition(ud2(0, 300, 0, 30), ud2(0.5, -150, 0.7, -15), "Out", "Linear", 0.05, true)
5111 wait(0.05)
5112 bk:TweenSizeAndPosition(ud2(0, 500, 0, 8), ud2(0.5, -150, 0.7, -4), "Out", "Linear", 0.05, true)
5113 wait(1.5)
5114 for i = 1, 2 do
5115 primary.TextTransparency = 1
5116 primary.TextStrokeTransparency = 1
5117 wait(0.1)
5118 primary.TextTransparency = 0
5119 primary.TextStrokeTransparency = 0
5120 wait(0.1)
5121 end
5122 primary.TextTransparency = 1
5123 primary.TextStrokeTransparency = 1
5124 wait(0.2)
5125 enemy.TextTransparency = 0
5126 enemy.TextStrokeTransparency = 0
5127 queuetypeout(enemy, 4)
5128 primary.TextTransparency = 0
5129 primary.TextStrokeTransparency = 0
5130 primary.Position = ud2(0.5, enemy.TextBounds.x + 10, 0.7, -10)
5131 primary.Text = "[" .. weap .. "]"
5132 queuetypeout(primary, 4)
5133 wait(3)
5134 for i = 1, 10 do
5135 point.TextTransparency = i / 10
5136 primary.TextTransparency = i / 10
5137 enemy.TextTransparency = i / 10
5138 point.TextStrokeTransparency = i / 10 + 0.4
5139 primary.TextStrokeTransparency = i / 10 + 0.4
5140 enemy.TextStrokeTransparency = i / 10 + 0.4
5141 wait(0.016666666666666666)
5142 end
5143 wait(0.1)
5144 trash.remove(display)
5145 end)
5146 end
5147 local function unlockedgun(weapon)
5148 local br = attachbar:Clone()
5149 local title = br.Title
5150 local atext = br.Attach
5151 br.Parent = maingui
5152 br.Position = ud2(0.5, 0, 0.15, 0)
5153 title.Text = "Unlocked New Gun!"
5154 atext.Text = weapon
5155 local t0 = tick()
5156 local stop
5157 stop = run.onstep:connect(function()
5158 local t = tick() - t0
5159 atext.TextTransparency = t < 2 and 0 or t < 2.5 and (t - 2) / 0.5 or 1
5160 title.TextTransparency = t < 2 and 0 or t < 2.5 and (t - 2) / 0.5 or 1
5161 if t > 3 then
5162 stop()
5163 br:Destroy()
5164 end
5165 end)
5166 end
5167 local function unlockedattach(weapon, attachments, killss)
5168 for i = 1, #attachments do
5169 do
5170 local attachment = attachments[i]
5171 local kills = killss[i]
5172 local br = attachbar:Clone()
5173 local money = br.Money
5174 local title = br.Title
5175 local atext = br.Attach
5176 br.Parent = maingui
5177 br.Position = ud2(0.5, 0, 0.15, 0)
5178 title.Text = "Unlocked " .. weapon .. " Attachment"
5179 atext.Text = attachment
5180 money.Text = "[+200]"
5181 local t0 = tick()
5182 local stop
5183 stop = run.onstep:connect(function()
5184 local t = tick() - t0
5185 atext.TextTransparency = t < 2 and 0 or t < 2.5 and (t - 2) / 0.5 or 1
5186 title.TextTransparency = t < 2 and 0 or t < 2.5 and (t - 2) / 0.5 or 1
5187 money.TextTransparency = t < 0.5 and 1 or t < 2.5 and 0 or t < 3 and (t - 2.5) / 0.5 or 1
5188 if t > 3 then
5189 stop()
5190 br:Destroy()
5191 end
5192 end)
5193 wait(3)
5194 end
5195 end
5196 end
5197 local function rankup(old, new, newguns)
5198 local br = rankbar:Clone()
5199 local money = br.Money
5200 local title = br.Title
5201 local rtext = br.Rank
5202 local count = 0
5203 local sht = maingui:GetChildren()
5204 for i = 1, #sht do
5205 if sht[i].Name == "RankBar" or sht[i].Name == "AttachBar" then
5206 count = count + 1
5207 end
5208 end
5209 br.Parent = maingui
5210 rtext.Text = new
5211 money.Text = "+" .. 5 * (new - old) * (81 + new + old) / 2 .. " CR"
5212 local t0 = tick()
5213 local stop
5214 stop = run.onstep:connect(function()
5215 local t = tick() - t0
5216 rtext.TextTransparency = t < 3 and 0 or t < 3.5 and (t - 3) / 0.5 or 1
5217 title.TextTransparency = t < 3 and 0 or t < 3.5 and (t - 3) / 0.5 or 1
5218 money.TextTransparency = t < 0.5 and 1 or t < 3.5 and 0 or t < 4 and (t - 3.5) / 0.5 or 1
5219 if t > 4 then
5220 stop()
5221 br:Destroy()
5222 if newguns then
5223 for i = 1, #newguns do
5224 unlockedgun(newguns[i])
5225 wait(3)
5226 end
5227 end
5228 end
5229 end)
5230 end
5231 function notify:testrankup(rank)
5232 rankup(rank)
5233 end
5234 function notify:reset()
5235 maingui = wfc(pgui, "MainGui")
5236 gamegui = wfc(maingui, "GameGui")
5237 framelist = wfc(gamegui, "NotifyList")
5238 if ffc(maingui, "KillBar") then
5239 trash.remove(maingui.KillBar)
5240 end
5241 end
5242 do
5243 local cf = CFrame.new
5244 local tos = cf().toObjectSpace
5245 local bcolor = BrickColor.new
5246 local repstore = game.ReplicatedStorage
5247 local gunmodels = repstore.GunModels
5248 local gunmodules = repstore.GunModules
5249 local attmodels = repstore.AttachmentModels
5250 local mpgunmodels = repstore.MeshPartGunModels
5251 local function hideparts(wepmodel, atttype, hide)
5252 local parts = wepmodel:GetChildren()
5253 local slottag
5254 for i = 1, #parts do
5255 if atttype == "Optics" then
5256 if parts[i].Name == "Iron" or parts[i].Name == "IronGlow" then
5257 if hide and not ffc(parts[i], "Hide") then
5258 local tag = new("IntValue", parts[i])
5259 tag.Name = "Hide"
5260 else
5261 local tag = ffc(parts[i], "Hide")
5262 if tag then
5263 tag:Destroy()
5264 end
5265 end
5266 parts[i].Transparency = hide and 1 or 0
5267 elseif parts[i].Name == "SightMark" and ffc(parts[i], "Decal") then
5268 parts[i].Decal.Transparency = hide and 1 or 0
5269 end
5270 elseif atttype == "Underbarrel" and parts[i].Name == "Grip" then
5271 if hide and not ffc(parts[i], "Hide") then
5272 local tag = new("IntValue", parts[i])
5273 tag.Name = "Hide"
5274 else
5275 local tag = ffc(parts[i], "Hide")
5276 if tag then
5277 tag:Destroy()
5278 end
5279 end
5280 parts[i].Transparency = hide and 1 or 0
5281 slottag = ffc(parts[i], "Slot1") or ffc(parts[i], "Slot2")
5282 end
5283 end
5284 return slottag
5285 end
5286 local function texturemodel(wepmodel, attachdata, camodata)
5287 local root = camodata
5288 for i, part in next, wepmodel:GetChildren() do
5289 if ffc(part, "Mesh") or part:IsA("UnionOperation") or part:IsA("MeshPart") then
5290 part.Anchored = true
5291 local slottag = ffc(part, "Slot1") or ffc(part, "Slot2")
5292 if slottag then
5293 for x, y in next, part:GetChildren() do
5294 if y:IsA("Texture") then
5295 y:Destroy()
5296 end
5297 end
5298 if root and root[slottag.Name] and root[slottag.Name].Name ~= "" then
5299 local t = Instance.new("Texture")
5300 t.Name = slottag.Name
5301 t.Texture = "rbxassetid://" .. root[slottag.Name].TextureProperties.TextureId
5302 t.Transparency = part.Transparency >= 0.8 and 1 or root[slottag.Name].TextureProperties.Transparency
5303 t.StudsPerTileU = root[slottag.Name].TextureProperties.StudsPerTileU
5304 t.StudsPerTileV = root[slottag.Name].TextureProperties.StudsPerTileV
5305 if root[slottag.Name].TextureProperties.Color then
5306 local colordata = root[slottag.Name].TextureProperties.Color
5307 t.Color3 = Color3.new(colordata.r / 255, colordata.g / 255, colordata.b / 255)
5308 end
5309 for x = 0, (part:IsA("MeshPart") or part:IsA("UnionOperation")) and 5 or 0 do
5310 local tt = t:Clone()
5311 tt.Face = x
5312 tt.Parent = part
5313 end
5314 t:Destroy()
5315 if not root[slottag.Name].BrickProperties.DefaultColor then
5316 if part:IsA("UnionOperation") then
5317 part.UsePartColor = true
5318 end
5319 if root[slottag.Name].BrickProperties.Color then
5320 local colordata = root[slottag.Name].BrickProperties.Color
5321 part.Color = Color3.new(colordata.r / 255, colordata.g / 255, colordata.b / 255)
5322 else
5323 part.BrickColor = bcolor(root[slottag.Name].BrickProperties.BrickColor)
5324 end
5325 end
5326 if root[slottag.Name].BrickProperties.Material then
5327 part.Material = root[slottag.Name].BrickProperties.Material
5328 end
5329 end
5330 end
5331 elseif part:IsA("Model") then
5332 texturemodel(part)
5333 end
5334 end
5335 end
5336 local function updategunmeshtype(wepmodel, attachdata, camodata)
5337 local root = camodata
5338 local meshpartmap = {}
5339 local mpmodel = ffc(mpgunmodels, wepmodel.Name)
5340 if mpmodel then
5341 for i, v in next, mpmodel:GetChildren() do
5342 if v:IsA("MeshPart") then
5343 meshpartmap[v.MeshId] = v
5344 end
5345 end
5346 end
5347 for i, v in next, wepmodel:GetChildren() do
5348 if ffc(v, "Mesh") or v:IsA("MeshPart") or v:IsA("UnionOperation") then
5349 v.Anchored = true
5350 v.CanCollide = false
5351 local slottag = ffc(v, "Slot1") or ffc(v, "Slot2")
5352 if slottag and root[slottag.Name].BrickProperties.EnableMaterial and ffc(v, "Mesh") then
5353 local mpart = meshpartmap[v.Mesh.MeshId]:Clone()
5354 mpart.CFrame = v.CFrame
5355 mpart.Name = v.Name
5356 mpart.Anchored = true
5357 mpart.Parent = wepmodel
5358 mpart.Color = v.Color
5359 mpart.Material = v.Material
5360 mpart.CanCollide = v.CanCollide
5361 mpart.Transparency = v.Transparency
5362 for x, y in next, v:GetChildren() do
5363 if y.Name == "Texture" then
5364 y:Clone().Parent = mpart
5365 end
5366 end
5367 v:Destroy()
5368 end
5369 end
5370 end
5371 end
5372 local function updategunattachment(wepmodel, atttype, attachname, wepnodes, preview)
5373 local parts = wepmodel:GetChildren()
5374 local data = require(ffc(gunmodules, wepmodel.Name))
5375 local attachdata = data.attachments[atttype] and data.attachments[atttype][attachname] or {}
5376 local refmodel = attachdata.altmodel and ffc(attmodels, attachdata.altmodel) or ffc(attmodels, attachname)
5377 if not refmodel then
5378 return
5379 end
5380 local model = refmodel:Clone()
5381 local basepart = wfc(model, "Node")
5382 local sidemount = attachdata.sidemount and attmodels[attachdata.sidemount]:Clone()
5383 local node
5384 model.Name = attachname
5385 if sidemount then
5386 local basenode = sidemount.Node
5387 local mountnode = attachdata.mountnode and wepnodes[attachdata.mountnode] or atttype == "Optics" and wepnodes.MountNode or atttype == "Underbarrel" and wepnodes.UnderMountNode
5388 local mountcframes = {}
5389 local mchildren = sidemount:GetChildren()
5390 local basecframe = basenode.CFrame
5391 for i = 1, #mchildren do
5392 if mchildren[i]:IsA("BasePart") then
5393 mountcframes[i] = tos(basecframe, mchildren[i].CFrame)
5394 end
5395 end
5396 basenode.CFrame = mountnode.CFrame
5397 for i = 1, #mchildren do
5398 if mchildren[i]:IsA("BasePart") then
5399 local v = mchildren[i]
5400 v.CFrame = mountnode.CFrame * mountcframes[i]
5401 end
5402 end
5403 node = attachdata.node and wepnodes[attachdata.node] or sidemount[atttype .. "Node"]
5404 sidemount.Parent = model
5405 else
5406 node = attachdata.node and wepnodes[attachdata.node] or wepnodes[atttype .. "Node"]
5407 end
5408 local weldcframes = {}
5409 local children = model:GetChildren()
5410 local basecframe = basepart and basepart.CFrame
5411 local slottag
5412 if atttype == "Optics" or atttype == "Underbarrel" then
5413 slottag = hideparts(wepmodel, atttype, true)
5414 end
5415 for i = 1, #children do
5416 if children[i]:IsA("BasePart") then
5417 weldcframes[i] = tos(basecframe, children[i].CFrame)
5418 end
5419 end
5420 basepart.CFrame = node.CFrame
5421 for i = 1, #children do
5422 if children[i]:IsA("BasePart") then
5423 local v = children[i]
5424 v.CFrame = node.CFrame * weldcframes[i]
5425 if slottag and (ffc(v, "Mesh") or v:IsA("UnionOperation") or v:IsA("MeshPart")) then
5426 slottag:Clone().Parent = v
5427 end
5428 end
5429 end
5430 model.Parent = wepmodel
5431 end
5432 function getgunmodel(wep, attachdata, camodata)
5433 local findgun = ffc(gunmodels, wep)
5434 if findgun then
5435 local wepmodel = findgun:Clone()
5436 local nodes = wfc(wepmodel, "MenuNodes")
5437 nodes.Parent = wepmodel
5438 wepmodel.PrimaryPart = wfc(nodes, "MenuNode")
5439 for i, v in next, attachdata, nil do
5440 if v ~= "" then
5441 updategunattachment(wepmodel, i, v, nodes)
5442 end
5443 end
5444 updategunmeshtype(wepmodel, attachdata, camodata)
5445 texturemodel(wepmodel, attachdata, camodata)
5446 return wepmodel
5447 end
5448 end
5449 end
5450 network:add("killed", function(killer, part, deathcf, weapon, rank, attachdata, camodata)
5451 char.deadcf = deathcf
5452 if killer == player then
5453 camera:setfixedcam(CFrame.new(deathcf.p, deathcf.p + deathcf.lookVector))
5454 else
5455 do
5456 local gunmodel = getgunmodel(weapon, attachdata, camodata)
5457 gunmodel.Parent = workspace.CurrentCamera
5458 gunmodel:SetPrimaryPartCFrame(deathcf * CFrame.Angles(0, math.rad(90), 0) + Vector3.new(0, 1, 0))
5459 local newbar = killbar:Clone()
5460 newbar.Killer.Label.Text = killer.Name
5461 newbar.Weapon.Label.Text = weapon
5462 newbar.Parent = maingui
5463 newbar.Rank.Label.Text = rank
5464 local wepnote = misc.WepNote:Clone()
5465 wepnote.Parent = gunmodel
5466 for i, v in next, newbar.Attachments:GetChildren() do
5467 v.Type.Text = "None"
5468 end
5469 if attachdata then
5470 for i, v in next, attachdata, nil do
5471 if i ~= "Name" and v ~= "" then
5472 newbar.Attachments[i].Type.Text = v
5473 end
5474 end
5475 end
5476 camera:setspectate(killer, part)
5477 delay(5, function()
5478 gunmodel:Destroy()
5479 end)
5480 end
5481 end
5482 end)
5483 network:add("unlockedattach", unlockedattach)
5484 network:add("rankup", rankup)
5485 network:add("bigaward", function(type, victim, weapon, pt)
5486 bigaward(type, victim, weapon, pt)
5487 end)
5488 network:add("smallaward", function(type, pt)
5489 smallaward(type, pt)
5490 end)
5491 function notify.step()
5492 if char.health <= 0 then
5493 local bar = ffc(maingui, "KillBar")
5494 if bar then
5495 local enemy = ffc(game:GetService("Players"), bar.Killer.Label.Text)
5496 if enemy then
5497 local health = hud:getplayerhealth(enemy)
5498 bar.Health.Label.Text = ceil(health)
5499 bar.Health.Label.TextColor3 = health < 20 and color(1, 0, 0) or health < 50 and color(1, 1, 0) or color(0, 1, 0)
5500 end
5501 end
5502 end
5503 end
5504end
5505print("Loading leaderboard module")
5506do
5507 local wfc = game.WaitForChild
5508 local ffc = game.FindFirstChild
5509 local ud2 = UDim2.new
5510 local ceil = math.ceil
5511 local cf = CFrame.new
5512 local v3 = Vector3.new
5513 local color = Color3.new
5514 local dot = Vector3.new().Dot
5515 local workspace = workspace
5516 local ray = Ray.new
5517 local new = Instance.new
5518 local raycast = workspace.FindPartOnRayWithIgnoreList
5519 local infolder = function(l, e)
5520 for i = 1, #l do
5521 if l[i].Name == e then
5522 return l[i]
5523 end
5524 end
5525 end
5526 local rtype = game.IsA
5527 local debris = game.Debris
5528 local player = game:GetService("Players").LocalPlayer
5529 local playertag = game.ReplicatedStorage.Character.PlayerTag
5530 local pgui = player.PlayerGui
5531 local misc = input.consoleon and game.ReplicatedStorage.XBOX or game.ReplicatedStorage.Misc
5532 local playerstat = misc.Player
5533 local board = wfc(pgui, "Leaderboard")
5534 if input.consoleon then
5535 board:Destroy()
5536 board = misc.Leaderboard:Clone()
5537 board.Parent = pgui
5538 end
5539 local main = wfc(board, "Main")
5540 local global = wfc(board, "Global")
5541 local ghost = wfc(main, "Ghosts")
5542 local phantom = wfc(main, "Phantoms")
5543 local gdataframe = wfc(ghost, "DataFrame")
5544 local pdataframe = wfc(phantom, "DataFrame")
5545 local ghostdata = wfc(gdataframe, "Data")
5546 local phantomdata = wfc(pdataframe, "Data")
5547 local spacing = input.consoleon and 30 or 25
5548 local function organize()
5549 local pp = game:GetService("Players"):GetPlayers()
5550 for i = 1, #pp do
5551 local v = pp[i]
5552 local rightparent = v.TeamColor == game.Teams.Ghosts.TeamColor and ghostdata or phantomdata
5553 local wrongparent = v.TeamColor ~= game.Teams.Ghosts.TeamColor and ghostdata or phantomdata
5554 local right = ffc(rightparent, v.Name)
5555 local wrong = ffc(wrongparent, v.Name)
5556 if not right and wrong then
5557 wrong.Parent = rightparent
5558 end
5559 end
5560 local gd = ghostdata:GetChildren()
5561 table.sort(gd, function(a, b)
5562 return tonumber(a.Score.Text) > tonumber(b.Score.Text)
5563 end)
5564 for i = 1, #gd do
5565 local v = gd[i]
5566 v.Position = ud2(0, 0, 0, i * spacing)
5567 if v.Name == player.Name then
5568 v.Username.TextColor3 = color(1, 1, 0)
5569 end
5570 end
5571 ghostdata.Parent.CanvasSize = ud2(0, 0, 0, (#gd + 1) * spacing)
5572 local pd = phantomdata:GetChildren()
5573 table.sort(pd, function(a, b)
5574 return tonumber(a.Score.Text) > tonumber(b.Score.Text)
5575 end)
5576 for i = 1, #pd do
5577 local v = pd[i]
5578 v.Position = ud2(0, 0, 0, i * spacing)
5579 if v.Name == player.Name then
5580 v.Username.TextColor3 = color(1, 1, 0)
5581 end
5582 end
5583 phantomdata.Parent.CanvasSize = ud2(0, 0, 0, (#pd + 1) * spacing)
5584 end
5585 local function addplayer(guy)
5586 local gbar = ffc(ghostdata, guy.Name)
5587 local pbar = ffc(phantomdata, guy.Name)
5588 if gbar or pbar then
5589 return
5590 end
5591 local bar = playerstat:Clone()
5592 bar.Name = guy.Name
5593 bar.Username.Text = guy.Name
5594 bar.Kills.Text = 0
5595 bar.Deaths.Text = 0
5596 bar.Streak.Text = 0
5597 bar.Score.Text = 0
5598 bar.Kdr.Text = 0
5599 bar.Rank.Text = 0
5600 if guy == player then
5601 bar.Username.TextColor3 = color(1, 1, 0)
5602 end
5603 bar.Parent = guy.TeamColor == game.Teams.Ghosts.TeamColor and ghostdata or phantomdata
5604 organize()
5605 end
5606 local function removeplayer(guy)
5607 local gbar = ffc(ghostdata, guy.Name)
5608 local pbar = ffc(phantomdata, guy.Name)
5609 if gbar then
5610 trash.remove(gbar)
5611 end
5612 if pbar then
5613 trash.remove(pbar)
5614 end
5615 organize()
5616 end
5617 local function updatestats(guy, data)
5618 local rightparent = guy.TeamColor == game.Teams.Ghosts.TeamColor and ghostdata or phantomdata
5619 local bar = ffc(rightparent, guy.Name)
5620 if not bar then
5621 organize()
5622 bar = ffc(rightparent, guy.Name)
5623 end
5624 if bar then
5625 for i, v in next, data, nil do
5626 bar[i].Text = v
5627 end
5628 end
5629 organize()
5630 end
5631 function leaderboard:show()
5632 main.Visible = true
5633 end
5634 function leaderboard:hide()
5635 main.Visible = false
5636 end
5637 network:add("removeplayer", removeplayer)
5638 network:add("newplayer", addplayer)
5639 network:add("updatestats", updatestats)
5640 organize()
5641 game:GetService("UserInputService").InputBegan:connect(function(keycode)
5642 local key = keycode.KeyCode
5643 if key == Enum.KeyCode.Tab and not input.iskeydown(Enum.KeyCode.LeftAlt) then
5644 if main.Visible then
5645 leaderboard:hide()
5646 else
5647 organize()
5648 leaderboard:show()
5649 end
5650 end
5651 end)
5652end
5653do
5654 local nv = Vector3.new()
5655 local dot = nv.Dot
5656 local minposroot = physics.minposroot
5657 local solve = physics.solve
5658 local playerservice = game:GetService("Players")
5659 local localplayer = playerservice.LocalPlayer
5660 local ts = {}
5661 local pps = {}
5662 local function getpva(ts, ps)
5663 local t = tick()
5664 local t1, t2, t3 = ts[1] - t, ts[2] - t, ts[3] - t
5665 local p1, p2, p3 = ps[1], ps[2], ps[3]
5666 if t3 and p3 then
5667 local d12 = t1 - t2
5668 local d23 = t2 - t3
5669 local d31 = t3 - t1
5670 local div = -d12 * d23 * d31
5671 local pnum = t2 * t3 * d23 * p1 + t1 * t3 * d31 * p2 + t1 * t2 * d12 * p3
5672 local vnum = (t3 * t3 - t2 * t2) * p1 + (t1 * t1 - t3 * t3) * p2 + (t2 * t2 - t1 * t1) * p3
5673 local anum = 2 * d23 * p1 + 2 * d31 * p2 + 2 * d12 * p3
5674 return pnum / div, vnum / div, anum / div
5675 elseif t2 and p2 then
5676 local div = t1 - t2
5677 local pnum = t1 * p2 - t2 * p1
5678 local vnum = p1 - p2
5679 return pnum / div, vnum / div, nv
5680 elseif t1 and p1 then
5681 return p1, nv, nv
5682 else
5683 return nv, nv, nv
5684 end
5685 end
5686 local function getcpoint(bp, bv, ba, tp, tv, ta)
5687 local rp = tp - bp
5688 local rv = tv - bv
5689 local ra = ta - ba
5690 local a0 = 2 * dot(rp, rv)
5691 local a1 = 2 * (dot(ra, rp) + dot(rv, rv))
5692 local a2 = 3 * dot(ra, rv)
5693 local a3 = dot(ra, ra)
5694 local t = minposroot(a3, a2, a1, a0)
5695 if t then
5696 local bpoint = bp + t * bv + t * t / 2 * ba
5697 local tpoint = tp + t * tv + t * t / 2 * ta
5698 local dist = (tpoint - bpoint).magnitude
5699 return t, dist, bpoint, tpoint
5700 end
5701 end
5702 function simpletraj(s, a, r)
5703 local a0 = 4 * dot(r, r)
5704 local a1 = -4 * (dot(a, r) + s * s)
5705 local a2 = dot(a, a)
5706 local u = minposroot(a2, a1, a0)
5707 if u then
5708 local t = u ^ 0.5
5709 return r / t - t / 2 * a
5710 end
5711 end
5712 function aimassist.edit(ratio, bp, bv, ba)
5713 local bestdist = 1 / 0
5714 local bestvalue = 0
5715 local bestt, bestbpoint, besttpoint
5716 for part, ps in next, pps, nil do
5717 local radius = ps.radius
5718 local value = ps.value
5719 local tp, tv, ta = getpva(ts, ps)
5720 local t, dist, bpoint, tpoint = getcpoint(bp, bv, ba, tp, tv, nv)
5721 if t then
5722 local ayy = (tp - bp).magnitude
5723 local maxdist = ayy * ratio * radius / (ayy + ratio * radius)
5724 if dist < maxdist and bestdist > dist and bestvalue < value then
5725 bestvalue = value
5726 bestdist = dist
5727 bestt = t
5728 bestbpoint = bpoint
5729 besttpoint = tpoint
5730 end
5731 end
5732 end
5733 if bestt then
5734 local tp = bestbpoint / ratio + (1 - 1 / ratio) * besttpoint
5735 local newv = bv + (tp - bestbpoint) / bestt
5736 return newv
5737 else
5738 return bv
5739 end
5740 end
5741 function aimassist.step()
5742 ts[1], ts[2], ts[3] = tick(), ts[1], ts[2]
5743 local players = playerservice:GetPlayers()
5744 local phash = {}
5745 for i, v in next, players, nil do
5746 local char = v.Character
5747 if char and v ~= localplayer then
5748 local head = char:FindFirstChild("Head")
5749 local torso = char:FindFirstChild("Torso")
5750 if head then
5751 phash[head] = true
5752 local ps = pps[head]
5753 if not ps then
5754 ps = {}
5755 ps.radius = 0.5
5756 ps.value = 100
5757 pps[head] = ps
5758 end
5759 ps[1], ps[2], ps[3] = head.Position, ps[1], ps[2]
5760 end
5761 if torso then
5762 phash[torso] = true
5763 local ps = pps[torso]
5764 if not ps then
5765 ps = {}
5766 ps.radius = 2
5767 ps.value = 50
5768 pps[torso] = ps
5769 end
5770 ps[1], ps[2], ps[3] = torso.CFrame * Vector3.new(0, -0.5, 0), ps[1], ps[2]
5771 end
5772 end
5773 end
5774 for i, v in next, pps, nil do
5775 if not phash[i] then
5776 pps[i] = nil
5777 end
5778 end
5779 end
5780end
5781print("Loading char module")
5782do
5783 local rtype = game.IsA
5784 local next = next
5785 local new = Instance.new
5786 local wfc = game.WaitForChild
5787 local ffc = game.FindFirstChild
5788 local getchildren = game.GetChildren
5789 local workspace = game.Workspace
5790 local cf = CFrame.new
5791 local vtws = CFrame.new().vectorToWorldSpace
5792 local angles = CFrame.Angles
5793 local nc = cf()
5794 local v3 = Vector3.new
5795 local nv = v3()
5796 local ray = Ray.new
5797 local raycast = workspace.FindPartOnRayWithIgnoreList
5798 local debris = game.Debris
5799 local dot = nv.Dot
5800 local ud2 = UDim2.new
5801 local abs = math.abs
5802 local tos = cf().toObjectSpace
5803 local player = game:GetService("Players").LocalPlayer
5804 local pgui = player.PlayerGui
5805 local repstore = game.ReplicatedStorage
5806 local repchar = repstore.Character
5807 local attmodels = repstore.AttachmentModels
5808 local character, humanoid, rootpart, rootjoint, statsloaded
5809 local thread = sequencer.new()
5810 local weapon
5811 local aiming = false
5812 local auto = false
5813 local burst = 0
5814 local reloading = false
5815 local sprinting = false
5816 local animating = false
5817 local stability = 0
5818 local basewalkspeed = 14
5819 local sprintspring = physics.spring.new()
5820 local climbing = physics.spring.new()
5821 local aimspring = physics.spring.new()
5822 local swingspring = physics.spring.new(nv)
5823 local speedspring = physics.spring.new()
5824 local velocityspring = physics.spring.new(nv)
5825 local pronespring = physics.spring.new(0)
5826 local truespeedspring = physics.spring.new(0)
5827 local equipspring = physics.spring.new(1)
5828 local muzzlespring = physics.spring.new(0)
5829 local walkspeedmult = 1
5830 sprintspring.s = 12
5831 sprintspring.d = 0.9
5832 climbing.s = 12
5833 climbing.d = 0.9
5834 aimspring.d = 0.9
5835 swingspring.s = 10
5836 swingspring.d = 0.75
5837 speedspring.s = 16
5838 velocityspring.s = 16
5839 pronespring.s = 8
5840 truespeedspring.s = 8
5841 equipspring.s = 12
5842 equipspring.d = 0.75
5843 local ignore = {
5844 workspace.Ignore,
5845 game.Workspace.CurrentCamera
5846 }
5847 local backwardsmult = 0.8
5848 local bodyforce = new("BodyVelocity")
5849 bodyforce.Name = "\n"
5850 local muzzlelight, walkspeedspring, headheightspring, updatewalkspeed
5851 walkspeedspring = physics.spring.new(basewalkspeed)
5852 walkspeedspring.s = 8
5853 headheightspring = physics.spring.new(1.5)
5854 headheightspring.s = 8
5855 char.acceleration = nv
5856 bodyforce.MaxForce = nv
5857 do
5858 local movementmode = "stand"
5859 local down = v3(0, -4, 0)
5860 function updatewalkspeed()
5861 if sprinting then
5862 walkspeedspring.t = 1.4 * walkspeedmult * basewalkspeed
5863 elseif movementmode == "prone" then
5864 walkspeedspring.t = walkspeedmult * basewalkspeed / 4
5865 elseif movementmode == "crouch" then
5866 walkspeedspring.t = walkspeedmult * basewalkspeed / 2
5867 elseif movementmode == "stand" then
5868 walkspeedspring.t = walkspeedmult * basewalkspeed
5869 end
5870 end
5871 local function setmovementmode(self, mode, dive)
5872 local oldmode = char.movementmode
5873 char.movementmode = mode
5874 movementmode = mode
5875 if mode == "prone" then
5876 if not dive and oldmode ~= mode then
5877 sound.play("stanceProne", 0.15)
5878 end
5879 headheightspring.t = -1.5
5880 pronespring.t = 1
5881 walkspeedspring.t = walkspeedmult * basewalkspeed / 4
5882 hud:setcrossscale(0.5)
5883 stability = 0.25
5884 if dive and sprinting and humanoid:GetState() ~= Enum.HumanoidStateType.Freefall then
5885 spawn(function()
5886 local lkvector = rootpart.CFrame.lookVector
5887 rootpart.Velocity = lkvector * 50 + v3(0, 40, 0)
5888 wait(0.1)
5889 rootpart.Velocity = lkvector * 60 + v3(0, 30, 0)
5890 wait(0.4)
5891 rootpart.Velocity = lkvector * 20 + v3(0, -10, 0)
5892 end)
5893 end
5894 elseif mode == "crouch" then
5895 if not dive and oldmode ~= mode then
5896 sound.play("stanceStandCrouch", 0.15)
5897 end
5898 headheightspring.t = 0
5899 pronespring.t = 0
5900 walkspeedspring.t = walkspeedmult * basewalkspeed / 2
5901 hud:setcrossscale(0.75)
5902 stability = 0.15
5903 if dive and sprinting and humanoid:GetState() ~= Enum.HumanoidStateType.Freefall then
5904 isSliding = true
5905 sound.play("slideStart", 0.25)
5906 spawn(function()
5907 local lkvector = rootpart.CFrame.lookVector
5908 local released
5909 bodyforce.MaxForce = v3(40000, 10, 40000)
5910 for i = 1, 20 do
5911 if input.keyboard.down.leftshift then
5912 lkvector = rootpart.CFrame.lookVector
5913 end
5914 bodyforce.Velocity = lkvector * (40 - i * 1.5) + v3(0, 0, 0)
5915 wait(0.03333333333333333)
5916 end
5917 bodyforce.MaxForce = nv
5918 if isSliding then
5919 isSliding = false
5920 sound.play("slideEnd", 0.15)
5921 end
5922 end)
5923 end
5924 elseif mode == "stand" then
5925 if oldmode ~= mode then
5926 sound.play("stanceStandCrouch", 0.15)
5927 end
5928 headheightspring.t = 1.5
5929 pronespring.t = 0
5930 walkspeedspring.t = walkspeedmult * basewalkspeed
5931 hud:setcrossscale(1)
5932 stability = 0
5933 end
5934 network:bounce("s" .. "t" .. "a" .. "n" .. "c" .. "e", player, mode)
5935 sprinting = false
5936 network:bounce("s" .. "p" .. "r" .. "i" .. "n" .. "t", player, sprinting)
5937 sprintspring.t = 0
5938 end
5939 function char.getstate()
5940 return humanoid:GetState()
5941 end
5942 function char:sprinting()
5943 return sprinting
5944 end
5945 char.setmovementmode = setmovementmode
5946 function char:setbasewalkspeed(newspeed)
5947 basewalkspeed = newspeed
5948 updatewalkspeed()
5949 end
5950 function char:setsprint(on)
5951 if on then
5952 if isSliding then
5953 isSliding = false
5954 sound.play("slideEnd", 0.15)
5955 end
5956 setmovementmode(nil, "stand")
5957 sprinting = true
5958 network:bounce("s" .. "p" .. "r" .. "i" .. "n" .. "t", player, sprinting)
5959 auto = false
5960 burst = 0
5961 if weapon and aiming and weapon.type ~= "KNIFE" then
5962 weapon:setaim(false)
5963 end
5964 walkspeedmult = 1
5965 if not reloading and not animating then
5966 sprintspring.t = 1
5967 end
5968 walkspeedspring.t = 1.5 * walkspeedmult * basewalkspeed
5969 elseif sprinting then
5970 sprinting = false
5971 network:bounce("s" .. "p" .. "r" .. "i" .. "n" .. "t", player, sprinting)
5972 sprintspring.t = 0
5973 walkspeedspring.t = walkspeedmult * basewalkspeed
5974 end
5975 end
5976 local function parkour()
5977 if weapon then
5978 weapon:playanimation("parkour")
5979 end
5980 sound.play("parkour", 0.25)
5981 local bp = new("BodyPosition")
5982 bp.Name = "\n"
5983 bp.position = rootpart.Position + rootpart.CFrame.lookVector.unit * char.speed * 1.5 + v3(0, 10, 0)
5984 bp.maxForce = v3(5000000000, 500000000, 500000000)
5985 bp.P = 4000
5986 bp.Parent = rootpart
5987 debris:AddItem(bp, 0.45)
5988 end
5989 function char:jump(height, numjumps)
5990 local rootcf = rootpart.CFrame
5991 local isonground = raycast(workspace, ray(rootcf.p, vtws(rootcf, down)), {
5992 workspace.CurrentCamera
5993 })
5994 if eventmod.ison() and numjumps or isonground then
5995 if movementmode == "prone" or movementmode == "crouch" then
5996 setmovementmode(nil, "stand")
5997 elseif not reloading and not aiming and not char.grenadehold then
5998 local r1 = ray(rootpart.CFrame.p + v3(0, 1.5, 0), rootpart.CFrame.lookVector * 25 + v3(0, 2, 0))
5999 local h1, e1 = raycast(workspace, r1, {
6000 character,
6001 camera.currentcamera
6002 })
6003 local r2 = ray(rootpart.CFrame.p - v3(0, 1, 0), rootpart.CFrame.lookVector * 25 - v3(0, 1, 0))
6004 local h2, e2 = raycast(workspace, r2, {
6005 character,
6006 camera.currentcamera
6007 })
6008 local r3 = ray(rootpart.CFrame.p - v3(0, 1.5, 0), rootpart.CFrame.lookVector * 25 - v3(0, 1.5, 0))
6009 local h3, e3 = raycast(workspace, r3, {
6010 character,
6011 camera.currentcamera
6012 })
6013 if h3 and (e3 - e2).Magnitude < 0.7 and (e3 - e1).Magnitude > 4 and (e3 - rootpart.Position).Magnitude < char.speed / 1.5 then
6014 parkour(h3)
6015 delay(0.1, function()
6016 gamelogic.resetjumps()
6017 end)
6018 elseif eventmod.ison() then
6019 if numjumps == 1 then
6020 bodyforce.Velocity = v3(rootpart.Velocity.X, height and (392.4 * height * loltimescale) ^ 0.5 or 200, rootpart.Velocity.Z)
6021 bodyforce.MaxForce = v3(999999, 999999, 999999)
6022 delay(0.1, function()
6023 bodyforce.MaxForce = nv
6024 end)
6025 else
6026 bodyforce.Velocity = rootpart.Velocity + v3(0, height and (392.4 * height * loltimescale) ^ 0.5 or 40, 0)
6027 bodyforce.MaxForce = v3(999999, 999999, 999999)
6028 delay(0.1, function()
6029 bodyforce.MaxForce = nv
6030 end)
6031 end
6032 else
6033 rootpart.Velocity = rootpart.Velocity + v3(0, height and (392.4 * height * loltimescale) ^ 0.5 or 40, 0)
6034 end
6035 elseif eventmod.ison() then
6036 if numjumps == 1 then
6037 bodyforce.Velocity = v3(rootpart.Velocity.X, height and (392.4 * height * loltimescale) ^ 0.5 or 200, rootpart.Velocity.Z)
6038 bodyforce.MaxForce = v3(999999, 999999, 999999)
6039 delay(0.1, function()
6040 bodyforce.MaxForce = nv
6041 end)
6042 else
6043 bodyforce.Velocity = rootpart.Velocity + v3(0, height and (392.4 * height * loltimescale) ^ 0.5 or 40, 0)
6044 bodyforce.MaxForce = v3(999999, 999999, 999999)
6045 delay(0.1, function()
6046 bodyforce.MaxForce = nv
6047 end)
6048 end
6049 else
6050 rootpart.Velocity = rootpart.Velocity + v3(0, height and (392.4 * height * loltimescale) ^ 0.5 or 40, 0)
6051 end
6052 end
6053 end
6054 end
6055 local equipping = false
6056 local zooming = false
6057 local rweld, lweld, larm, rarm, lmodel, rmodel, lmain, rmain
6058 local sin = math.sin
6059 local cos = math.cos
6060 char.grenadehold = false
6061 local function gunbob(a, r)
6062 local a, r = a or 1, r or 1
6063 local d, s, v = char.distance * 6.28318 * 3 / 4, char.speed, -char.velocity
6064 if s < basewalkspeed then
6065 local w = v3(r * sin(d / 4 - 1) / 256 + r * (sin(d / 64) - r * v.z / 4) / 512, r * cos(d / 128) / 128 - r * cos(d / 8) / 256, r * sin(d / 8) / 128 + r * v.x / 1024) * s / 20 * 6.28318
6066 return cf(r * cos(d / 8 - 1) * s / 196, 1.25 * a * sin(d / 4) * s / 512, 0) * cframe.fromaxisangle(w)
6067 else
6068 local w = v3((r * sin(d / 4 - 1) / 256 + r * (sin(d / 64) - r * v.z / 4) / 512) * s / 20 * 6.28318, (r * cos(d / 128) / 128 - r * cos(d / 8) / 256) * s / 20 * 6.28318, r * sin(d / 8) / 128 * (5 * s - 56) / 20 * 6.28318 + r * v.x / 1024)
6069 return cf(r * cos(d / 8 - 1) * (5 * s - 56) / 196, 1.25 * a * sin(d / 4) * s / 512, 0) * cframe.fromaxisangle(w)
6070 end
6071 end
6072 local function gunsway(a)
6073 local d, s = tick() * 6, 2 * (1.2 - a)
6074 return cf(cos(d / 8) * s / 128, -sin(d / 4) * s / 128, sin(d / 16) * s / 64)
6075 end
6076 local asdf = function()
6077 end
6078 local function weldattachment(gun, type, attname, menunode, mainpart, attdata, welddata, menunodes)
6079 local refmodel = ffc(attmodels, attname)
6080 local copies = attdata.copy or 0
6081 local slottag
6082 if refmodel then
6083 for i = 0, copies do
6084 local model = refmodel:Clone()
6085 local attnode = model.Node
6086 local weldcframes = {}
6087 local maincf = attnode.CFrame
6088 local parts = getchildren(model)
6089 for i = 1, #parts do
6090 local v = parts[i]
6091 if v:IsA("BasePart") then
6092 weldcframes[v] = tos(maincf, v.CFrame)
6093 end
6094 end
6095 attnode.CFrame = i == 0 and menunode.CFrame or menunodes[attdata.copynodes[i]].CFrame
6096 if type == "Optics" then
6097 local del = gun:GetChildren()
6098 for i = 1, #del do
6099 if del[i].Name == "Iron" or del[i].Name == "IronGlow" or del[i].Name == "SightMark" and not ffc(del[i], "Stay") then
6100 del[i]:Destroy()
6101 end
6102 end
6103 elseif type == "Underbarrel" then
6104 local del = gun:GetChildren()
6105 for i = 1, #del do
6106 if del[i].Name == "Grip" then
6107 slottag = ffc(del[i], "Slot1") or ffc(del[i], "Slot2")
6108 del[i]:Destroy()
6109 end
6110 end
6111 end
6112 if attdata.replacemag then
6113 local del = gun:GetChildren()
6114 for x = 1, #del do
6115 if i == 0 and del[x].Name == "Mag" or i > 0 and del[x].Name == "Mag" .. i + 1 then
6116 del[x]:Destroy()
6117 end
6118 end
6119 end
6120 for x = 1, #parts do
6121 local v = parts[x]
6122 if v:IsA("BasePart") then
6123 local weld, c0
6124 if v ~= attnode then
6125 c0 = tos(mainpart.CFrame, attnode.CFrame)
6126 weld = new("Weld", mainpart)
6127 weld.Part0 = mainpart
6128 weld.Part1 = v
6129 weld.C0 = c0 * weldcframes[v]
6130 end
6131 if slottag and v:IsA("UnionOperation") then
6132 slottag:Clone().Parent = v
6133 end
6134 if attdata.replacemag and v.Name == "AttMag" then
6135 local magname = i == 0 and "Mag" or i > 0 and "Mag" .. i + 1
6136 v.Name = magname
6137 welddata[magname] = {
6138 part = v,
6139 weld = weld,
6140 basec0 = c0 * weldcframes[v],
6141 basetransparency = v.Transparency
6142 }
6143 end
6144 v.Anchored = false
6145 v.CanCollide = false
6146 v.Parent = gun
6147 end
6148 end
6149 attnode:Destroy()
6150 model:Destroy()
6151 end
6152 end
6153 return slottag
6154 end
6155 local function texturemodel(root, model)
6156 local bcolor = BrickColor.new
6157 for i, part in next, model:GetChildren() do
6158 if ffc(part, "Mesh") or part:IsA("UnionOperation") or part:IsA("MeshPart") then
6159 local slottag = ffc(part, "Slot1") or ffc(part, "Slot2")
6160 if slottag then
6161 for x, y in next, part:GetChildren() do
6162 if y:IsA("Texture") then
6163 y:Destroy()
6164 end
6165 end
6166 if root[slottag.Name].Name ~= "" then
6167 if not effects.disable1pcamoskins then
6168 local t = Instance.new("Texture")
6169 t.Name = slottag.Name
6170 t.Texture = "rbxassetid://" .. root[slottag.Name].TextureProperties.TextureId
6171 t.Transparency = part.Transparency == 1 and 1 or root[slottag.Name].TextureProperties.Transparency
6172 t.StudsPerTileU = root[slottag.Name].TextureProperties.StudsPerTileU
6173 t.StudsPerTileV = root[slottag.Name].TextureProperties.StudsPerTileV
6174 if root[slottag.Name].TextureProperties.Color then
6175 local colordata = root[slottag.Name].TextureProperties.Color
6176 t.Color3 = Color3.new(colordata.r / 255, colordata.g / 255, colordata.b / 255)
6177 end
6178 for x = 0, (part:IsA("MeshPart") or part:IsA("UnionOperation")) and 5 or 0 do
6179 local tt = t:Clone()
6180 tt.Face = x
6181 tt.Parent = part
6182 end
6183 t:Destroy()
6184 end
6185 if not root[slottag.Name].BrickProperties.DefaultColor then
6186 if part:IsA("UnionOperation") then
6187 part.UsePartColor = true
6188 end
6189 local colordata = root[slottag.Name].BrickProperties.Color
6190 if colordata then
6191 part.Color = Color3.new(colordata.r / 255, colordata.g / 255, colordata.b / 255)
6192 else
6193 part.BrickColor = bcolor(root[slottag.Name].BrickProperties.BrickColor)
6194 end
6195 end
6196 if root[slottag.Name].BrickProperties.Material then
6197 part.Material = root[slottag.Name].BrickProperties.Material
6198 end
6199 end
6200 end
6201 elseif part:IsA("Model") then
6202 texturemodel(root, part)
6203 end
6204 end
6205 end
6206 local tos = CFrame.new().toObjectSpace
6207 local mpgunmodels = game.ReplicatedStorage.MeshPartGunModels
6208 local function weldmodel(model, mainpart, attachlist, data, camodata)
6209 local welddata = {}
6210 local parts = model:GetChildren()
6211 local maincf = mainpart.CFrame
6212 local menunodes = ffc(model, "MenuNodes")
6213 local meshpartmap = {}
6214 local mpmodel = ffc(mpgunmodels, model.Name)
6215 if mpmodel then
6216 for i, v in next, mpmodel:GetChildren() do
6217 if v:IsA("MeshPart") then
6218 meshpartmap[v.MeshId] = v
6219 end
6220 end
6221 end
6222 for i = 1, #parts do
6223 local part = parts[i]
6224 if part ~= mainpart and part:IsA("BasePart") then
6225 local name = part.Name
6226 if ffc(part, "Mesh") then
6227 local slottag = ffc(part, "Slot1") or ffc(part, "Slot2")
6228 if slottag and camodata[slottag.Name].BrickProperties.EnableMaterial then
6229 local mpart = meshpartmap[part.Mesh.MeshId]:Clone()
6230 mpart.Parent = model
6231 mpart.Name = name
6232 mpart.CFrame = part.CFrame
6233 part:Destroy()
6234 part = mpart
6235 end
6236 end
6237 if data and data.weldexception and data.weldexception[name] and ffc(model, data.weldexception[name]) then
6238 local nbase = model[data.weldexception[name]]
6239 local nmaincf = nbase.CFrame
6240 local c0 = tos(nmaincf, part.CFrame)
6241 local weld = new("Weld", nbase)
6242 weld.Part0 = nbase
6243 weld.Part1 = part
6244 weld.C0 = c0
6245 welddata[name] = {
6246 part = part,
6247 weld = weld,
6248 basec0 = c0,
6249 basetransparency = part.Transparency
6250 }
6251 else
6252 local c0 = tos(maincf, part.CFrame)
6253 local weld = new("Weld", mainpart)
6254 weld.Part0 = mainpart
6255 weld.Part1 = part
6256 weld.C0 = c0
6257 welddata[name] = {
6258 part = part,
6259 weld = weld,
6260 basec0 = c0,
6261 basetransparency = part.Transparency
6262 }
6263 end
6264 part.Anchored = false
6265 part.CanCollide = false
6266 end
6267 end
6268 if menunodes and #menunodes:GetChildren() > 1 then
6269 local nodes = menunodes:GetChildren()
6270 for i = 1, #nodes do
6271 local v = nodes[i]
6272 local c0 = tos(maincf, v.CFrame)
6273 local weld = new("Weld", mainpart)
6274 weld.Part0 = mainpart
6275 weld.Part1 = v
6276 weld.C0 = c0
6277 v.Anchored = false
6278 v.CanCollide = false
6279 end
6280 for i, v in next, attachlist, nil do
6281 if i ~= "Name" and v and v ~= "" then
6282 local attachdata = data.attachments and data.attachments[i][v] or {}
6283 local sidemount = attachdata.sidemount and attmodels[attachdata.sidemount]:Clone()
6284 local mountweldpart = attachdata.mountweldpart and model[attachdata.mountweldpart] or mainpart
6285 local node = attachdata.node and menunodes[attachdata.node]
6286 if sidemount then
6287 local basenode = sidemount.Node
6288 local mountnode = attachdata.mountnode and menunodes[attachdata.mountnode] or i == "Optics" and menunodes.MountNode or i == "Underbarrel" and menunodes.UnderMountNode
6289 local mountcframes = {}
6290 local mchildren = sidemount:GetChildren()
6291 local basecframe = basenode.CFrame
6292 for i = 1, #mchildren do
6293 if mchildren[i]:IsA("BasePart") then
6294 mountcframes[i] = tos(basecframe, mchildren[i].CFrame)
6295 end
6296 end
6297 basenode.CFrame = mountnode.CFrame
6298 for x = 1, #mchildren do
6299 local p = mchildren[x]
6300 if p:IsA("BasePart") then
6301 local c0 = tos(mountweldpart.CFrame, basenode.CFrame)
6302 if p ~= basenode then
6303 local weld = new("Weld", mainpart)
6304 weld.Part0 = mountweldpart
6305 weld.Part1 = p
6306 weld.C0 = c0 * mountcframes[x]
6307 p.CFrame = basenode.CFrame * mountcframes[x]
6308 end
6309 p.Anchored = false
6310 p.CanCollide = false
6311 p.Parent = model
6312 if p.Name == i .. "Node" and not node then
6313 node = p
6314 elseif p.Name == "SightMark" then
6315 local stay = new("Model", p)
6316 stay.Name = "Stay"
6317 end
6318 end
6319 end
6320 basenode.Parent = menunodes
6321 sidemount:Destroy()
6322 else
6323 node = attachdata.node and menunodes[attachdata.node] or menunodes[i .. "Node"]
6324 end
6325 local weldpart = attachdata.weldpart and model[attachdata.weldpart] or mainpart
6326 weldattachment(model, i, v, node, weldpart, attachdata, welddata, menunodes)
6327 end
6328 end
6329 menunodes:Destroy()
6330 end
6331 texturemodel(camodata, model)
6332 welddata.camodata = camodata
6333 mainpart.Anchored = false
6334 mainpart.CanCollide = false
6335 return welddata
6336 end
6337 local clone = game.Clone
6338 local currentcamera = game.Workspace.CurrentCamera
6339 local ffc = game.FindFirstChild
6340 function char:loadarms(newlarm, newrarm, newlmain, newrmain)
6341 currentcamera = game.Workspace.CurrentCamera
6342 larm, rarm, lmain, rmain = newlarm, newrarm, newlmain, newrmain
6343 lmodel = clone(larm, weapon and currentcamera)
6344 rmodel = clone(rarm, weapon and currentcamera)
6345 local lmainpart = lmodel[newlmain]
6346 local rmainpart = rmodel[newrmain]
6347 rweld = new("Motor6D")
6348 lweld = new("Motor6D")
6349 weldmodel(lmodel, lmainpart)
6350 weldmodel(rmodel, rmainpart)
6351 lweld.Part0 = rootpart
6352 lweld.Part1 = lmainpart
6353 lweld.Parent = lmainpart
6354 rweld.Part0 = rootpart
6355 rweld.Part1 = rmainpart
6356 rweld.Parent = rmainpart
6357 end
6358 function char:reloadsprings()
6359 sprintspring = physics.spring.new()
6360 aimspring = physics.spring.new()
6361 swingspring = physics.spring.new(nv)
6362 speedspring = physics.spring.new()
6363 velocityspring = physics.spring.new(nv)
6364 pronespring = physics.spring.new(0)
6365 truespeedspring = physics.spring.new(0)
6366 equipspring = physics.spring.new(1)
6367 muzzlespring = physics.spring.new(0)
6368 equipspring.s = 12
6369 equipspring.d = 0.75
6370 sprintspring.s = 12
6371 sprintspring.d = 0.9
6372 aimspring.d = 0.9
6373 swingspring.s = 10
6374 swingspring.d = 0.75
6375 speedspring.s = 16
6376 velocityspring.s = 16
6377 pronespring.s = 8
6378 truespeedspring.s = 8
6379 muzzlespring.s = 50
6380 muzzlespring.d = 1
6381 walkspeedspring = physics.spring.new(basewalkspeed)
6382 walkspeedspring.s = 8
6383 headheightspring = physics.spring.new(1.5)
6384 headheightspring.s = 8
6385 if muzzlelight then
6386 muzzlelight:Destroy()
6387 end
6388 muzzlelight = repstore.Effects.MuzzleLight:Clone()
6389 muzzlelight.Parent = rootpart
6390 end
6391 local aimbotshit = {}
6392 do
6393 local function reweld(welddata)
6394 for i, v in next, welddata, nil do
6395 if v.clone then
6396 welddata[i] = nil
6397 trash.remove(v.weld)
6398 trash.remove(v.part)
6399 else
6400 v.weld.C0 = v.basec0
6401 if v.part then
6402 v.part.Transparency = v.basetransparency
6403 end
6404 end
6405 end
6406 end
6407 local rand = math.random
6408 local ffc = game.FindFirstChild
6409 local function pickv3(v0, v1)
6410 return v0 + v3(rand(), rand(), rand()) * (v1 - v0)
6411 end
6412 function char:firemuzzlelight()
6413 muzzlespring:accelerate(100)
6414 end
6415 function char:loadgrenade(data, model, spare)
6416 local self = {}
6417 local thread2 = sequencer.new()
6418 local ignorelist = ignore
6419 local dunhit = {}
6420 local main = data.mainpart
6421 local mainoffset = data.mainoffset
6422 local mainpart = model[main]
6423 local pin = model[data.pin]
6424 local lever = model[data.lever]
6425 local ammo = spare or data.spare
6426 local lastweapon = weapon
6427 local equipped = false
6428 local throwing = false
6429 local cooking = false
6430 local exploded = false
6431 local bounceelasticity = 0.2
6432 local frictionconstant = 0.08
6433 local acceleration = v3(0, -80, 0)
6434 local velocity = v3()
6435 local position = v3()
6436 local cooktime = 0
6437 local blowup = 0
6438 local t0 = 0
6439 local lastbounce = false
6440 local lasttrailt = 0
6441 local lasttrailpos = v3()
6442 local rot0
6443 local offset = v3()
6444 local av0, flyingnade, indicator
6445 local fusetime = data.fusetime
6446 local blastradius = data.blastradius
6447 local throwspeed = data.throwspeed
6448 local r0, r1, d0, d1 = data.range0, data.range1, data.damage0, data.damage1
6449 local animdata = weldmodel(model, mainpart)
6450 local mainweld = new("Motor6D", mainpart)
6451 animdata[main] = {
6452 weld = {C0 = nc},
6453 basec0 = nc
6454 }
6455 animdata.larm = {
6456 weld = {
6457 C0 = data.larmoffset
6458 },
6459 basec0 = data.larmoffset
6460 }
6461 animdata.rarm = {
6462 weld = {
6463 C0 = data.rarmoffset
6464 },
6465 basec0 = data.rarmoffset
6466 }
6467 mainweld.Part0 = rootpart
6468 mainweld.Part1 = mainpart
6469 local equipcf = data.equipoffset
6470 local sprintcf = cframe.interpolator(data.sprintoffset)
6471 local pronecf = cframe.interpolator(data.proneoffset)
6472 self.type = data.type
6473 self.cooking = cooking
6474 function self:setequipped(on)
6475 if on and (not equipped or not equipping) then
6476 if char.health <= 0 then
6477 return
6478 end
6479 aimbotshit.speed = throwspeed
6480 aimbotshit.accel = acceleration
6481 aimbotshit.addv = true
6482 char.grenadehold = true
6483 hud:setcrosssettings(data.crosssize, data.crossspeed, data.crossdamper, main)
6484 hud:updatefiremode("KNIFE")
6485 hud:updateammo("GRENADE")
6486 equipping = true
6487 thread:clear()
6488 if weapon then
6489 lastweapon = weapon
6490 weapon:setequipped(false)
6491 end
6492 thread:add(function()
6493 char:setbasewalkspeed(data.walkspeed)
6494 equipspring.t = 0
6495 equipping = false
6496 equipped = true
6497 local shit = mainpart:GetChildren()
6498 for i = 1, #shit do
6499 if shit[i]:IsA("Weld") and (not shit[i].Part1 or shit[i].Part1.Parent ~= model) then
6500 shit[i]:Destroy()
6501 end
6502 end
6503 lmodel.Parent = currentcamera
6504 rmodel.Parent = currentcamera
6505 model.Parent = currentcamera
6506 weapon = self
6507 end)
6508 elseif not on and equipped then
6509 equipspring.t = 1
6510 thread:clear()
6511 thread:add(function()
6512 equipped = false
6513 lmodel.Parent = nil
6514 rmodel.Parent = nil
6515 model.Parent = nil
6516 animating = false
6517 weapon = nil
6518 end)
6519 thread:delay(0.5)
6520 end
6521 end
6522 local grenadeanim
6523 local castresolution = 0.016666666666666666
6524 local function createnade()
6525 if not (not roundsystem.lock and mainpart.Parent) or gamelogic.gammo <= 0 then
6526 return
6527 end
6528 gamelogic.gammo = gamelogic.gammo - 1
6529 hud:updateammo("GRENADE")
6530 local time = tick()
6531 trash.remove(mainweld)
6532 flyingnade = mainpart
6533 flyingnade.Parent = workspace.Ignore
6534 flyingnade.Anchored = true
6535 indicator = ffc(flyingnade, "Indicator")
6536 if indicator then
6537 indicator.Friendly.Visible = true
6538 end
6539 flyingnade.Trail.Enabled = true
6540 model.Parent = nil
6541 velocity = 0 < char.health and camera.lookvector * throwspeed + rootpart.Velocity or v3()
6542 position = char.deadcf and char.deadcf.p or flyingnade.CFrame.p
6543 lasttrailt = time
6544 lasttrailpos = position
6545 t0 = time
6546 av0 = (camera.cframe - camera.cframe.p) * v3(19.539, -5, 0)
6547 rot0 = flyingnade.CFrame - flyingnade.CFrame.p
6548 local dt = castresolution
6549 local nadecf = flyingnade.CFrame
6550 grenadeanim = {
6551 curi = 1,
6552 time = time,
6553 blowuptime = blowup - time,
6554 frames = {
6555 {
6556 t0 = 0,
6557 p0 = position,
6558 v0 = velocity,
6559 offset = nv,
6560 a = acceleration,
6561 rot0 = nadecf - nadecf.p,
6562 rotv = av0,
6563 glassbreaks = {}
6564 }
6565 }
6566 }
6567 for i = 1, (blowup - time) / dt + 1 do
6568 local newposition = position + dt * velocity + dt * dt / 2 * acceleration
6569 local newvelocity = velocity + dt * acceleration
6570 local hit, pos, norm = raycast(workspace, ray(position, newposition - position - 0.05 * offset), ignorelist)
6571 local t = dt * i
6572 if hit and hit.Name ~= "Window" and hit.Name ~= "Col" then
6573 rot0 = flyingnade.CFrame - flyingnade.CFrame.p
6574 offset = 0.2 * norm
6575 av0 = norm:Cross(velocity) / 0.2
6576 local delta = pos - position
6577 local fixpls = 1 - 0.001 / delta.magnitude
6578 fixpls = fixpls < 0 and 0 or fixpls
6579 position = position + fixpls * delta + 0.05 * norm
6580 local normvel = dot(norm, velocity) * norm
6581 local tanvel = velocity - normvel
6582 local geometricdeceleration
6583 local d1 = -dot(norm, acceleration)
6584 local d2 = -(1 + bounceelasticity) * dot(norm, velocity)
6585 geometricdeceleration = 1 - frictionconstant * (10 * (d1 < 0 and 0 or d1) * dt + (d2 < 0 and 0 or d2)) / tanvel.magnitude
6586 geometricdeceleration = geometricdeceleration < 0 and 0 or geometricdeceleration
6587 velocity = geometricdeceleration * tanvel - bounceelasticity * normvel
6588 if 1 > velocity.magnitude then
6589 local frames = grenadeanim.frames
6590 frames[#frames + 1] = {
6591 t0 = t - dt * (newposition - pos).magnitude / (newposition - position).magnitude,
6592 p0 = position,
6593 v0 = nv,
6594 a = nv,
6595 rot0 = cframe.fromaxisangle(t * av0) * rot0,
6596 offset = 0.2 * norm,
6597 rotv = nv,
6598 glassbreaks = {}
6599 }
6600 break
6601 end
6602 local frames = grenadeanim.frames
6603 local nexti = #frames + 1
6604 frames[#frames + 1] = {
6605 t0 = t - dt * (newposition - pos).magnitude / (newposition - position).magnitude,
6606 p0 = position,
6607 v0 = velocity,
6608 a = lastbounce and nv or acceleration,
6609 rot0 = cframe.fromaxisangle(t * av0) * rot0,
6610 offset = 0.2 * norm,
6611 rotv = av0,
6612 glassbreaks = {}
6613 }
6614 lastbounce = true
6615 else
6616 position = newposition
6617 velocity = newvelocity
6618 lastbounce = false
6619 if hit and hit.Name == "Window" then
6620 local frames = grenadeanim.frames
6621 local glassbreaks = frames[#frames].glassbreaks
6622 glassbreaks[#glassbreaks + 1] = {t = t, part = hit}
6623 end
6624 end
6625 end
6626 network:send("n" .. "e" .. "w" .. "g" .. "r" .. "e" .. "n" .. "a" .. "d" .. "e", data.name, grenadeanim)
6627 end
6628 function self:throw(dpos)
6629 if roundsystem.lock or gamelogic.gammo <= 0 then
6630 return
6631 end
6632 if cooking and not throwing then
6633 local time = tick()
6634 throwing = true
6635 cooking = false
6636 self.cooking = cooking
6637 exploded = false
6638 sprintspring.t = 0
6639 thread:add(animation.player(animdata, data.animations.throw))
6640 thread2:delay(0.07)
6641 thread2:add(function()
6642 createnade(dpos)
6643 if sprinting then
6644 sprintspring.t = 1
6645 end
6646 throwing = false
6647 end)
6648 thread:add(function()
6649 if lastweapon then
6650 lastweapon:setequipped(true)
6651 end
6652 end)
6653 end
6654 end
6655 function self:pull()
6656 local time = tick()
6657 if not cooking and not throwing then
6658 if animating then
6659 thread:add(animation.reset(animdata, 0.1))
6660 animating = false
6661 end
6662 thread:add(animation.player(animdata, data.animations.pull))
6663 thread:add(function()
6664 hud.crossspring:accelerate(data.crossexpansion)
6665 trash.remove(pin)
6666 cooking = true
6667 self.cooking = cooking
6668 cooktime = time + fusetime
6669 blowup = time + 5
6670 end)
6671 end
6672 end
6673 local function hitdetection(hit, dist, position)
6674 if hit.Parent then
6675 if ffc(game:GetService("Players"), hit.Parent.Name) and not dunhit[hit.Parent] and ffc(game:GetService("Players"), hit.Parent.Name) then
6676 local p = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
6677 if p.TeamColor ~= player.TeamColor or p == player then
6678 local wall, pos = raycast(workspace, ray(hit.Position, (hit.Position - position).unit * -dist), ignorelist)
6679 if not wall then
6680 local damage = dist < r0 and d0 or dist < r1 and (d1 - d0) / (r1 - r0) * (dist - r0) + d0 or d1
6681 effects:bloodhit(position, hit, hit.Position, hit.CFrame.lookVector, true, damage, (hit.Position - position).unit * 50)
6682 if p == player then
6683 p = nil
6684 end
6685 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "h" .. "e" .. "a" .. "l" .. "t" .. "h" .. "x", p, tick(), -damage, data.name, hit, position, {}, {}, hit.Position)
6686 dunhit[hit.Parent] = true
6687 hud:firehitmarker(hit.Name == "Head")
6688 end
6689 end
6690 elseif hit.Parent.Name == "Dead" then
6691 effects:bloodhit(position, hit, hit.Position, hit.CFrame.lookVector, true, 100, (hit.Position - position).unit * 50)
6692 end
6693 end
6694 end
6695 local function explode(position)
6696 local player = game:GetService("Players").LocalPlayer
6697 local range = player:DistanceFromCharacter(position)
6698 if ffc(flyingnade, "Fire") then
6699 if range <= 50 then
6700 sound.play("fragClose", 2, 1, flyingnade, true)
6701 elseif range <= 200 then
6702 sound.play("fragMed", 3, 1, flyingnade, true)
6703 elseif range > 200 then
6704 sound.play("fragFar", 3, 1, flyingnade, true)
6705 end
6706 end
6707 exploded = true
6708 trash.remove(flyingnade)
6709 dunhit = {}
6710 if data.grenadetype == "Frag" then
6711 local boom = new("Explosion", workspace)
6712 boom.Position = position
6713 boom.BlastRadius = blastradius
6714 boom.BlastPressure = 0
6715 boom.DestroyJointRadiusPercent = 0
6716 boom.Hit:connect(function(hit, dist)
6717 hitdetection(hit, dist, position)
6718 end)
6719 elseif data.grenadetype == "Smoke" then
6720 elseif data.grenadetype == "Flash" then
6721 elseif data.grenadetype == "Flare" then
6722 elseif data.grenadetype == "Throwing" then
6723 end
6724 end
6725 local lasttime = tick()
6726 local lastparticle = tick()
6727 local disconnect
6728 disconnect = run.onstep:connect(function(dt)
6729 thread2.step()
6730 local time = tick()
6731 if cooking and not throwing then
6732 if time > cooktime or not input.keyboard.down.g then
6733 self:throw()
6734 elseif dt > (cooktime - time) % 1 then
6735 hud.crossspring:accelerate(data.crossexpansion)
6736 end
6737 end
6738 if flyingnade and grenadeanim then
6739 local st = grenadeanim.time
6740 local i = grenadeanim.curi
6741 local frames = grenadeanim.frames
6742 local frame = frames[i]
6743 local glassbreaks = frame.glassbreaks
6744 for j = 1, #glassbreaks do
6745 local glassbreak = glassbreaks[j]
6746 if lasttime < st + glassbreak.t and time >= st + glassbreak.t then
6747 effects:breakwindow(glassbreak.part, nil, nil, true, true)
6748 end
6749 end
6750 local nextframe = frames[i + 1]
6751 if nextframe and time > grenadeanim.time + nextframe.t0 then
6752 grenadeanim.curi = i + 1
6753 frame = nextframe
6754 end
6755 local t = time - (st + frame.t0)
6756 local pos = frame.p0 + t * frame.v0 + t * t / 2 * frame.a + frame.offset
6757 local rot = cframe.fromaxisangle(t * frame.rotv) * frame.rot0
6758 flyingnade.CFrame = rot + pos
6759 if indicator then
6760 indicator.Enabled = not raycast(workspace, ray(pos, camera.cframe.p - pos), ignorelist)
6761 end
6762 if time > st + grenadeanim.blowuptime then
6763 explode(pos)
6764 disconnect()
6765 end
6766 end
6767 lasttime = time
6768 end)
6769 function self.step()
6770 local mainweldc0 = rootpart.CFrame:inverse() * camera.shakecframe * mainoffset * animdata[main].weld.C0 * pronecf(pronespring.p) * cf(0, 0, 1) * cframe.fromaxisangle(swingspring.v) * cf(0, 0, -1) * gunbob(0.7, 1) * gunsway(0) * cframe.interpolate(sprintcf(truespeedspring.p / walkspeedspring.p * sprintspring.p), data.equipoffset, equipspring.p)
6771 mainweld.C0 = mainweldc0
6772 lweld.C0 = mainweldc0 * animdata.larm.weld.C0
6773 rweld.C0 = mainweldc0 * animdata.rarm.weld.C0
6774 if 0 >= char.health then
6775 self:setequipped(false)
6776 end
6777 end
6778 return self
6779 end
6780 function char:loadknife(data, model, camodata)
6781 local self = {}
6782 self.name = data.name
6783 self.type = data.type
6784 self.camodata = camodata
6785 local thread2 = sequencer.new()
6786 local ignorelist = {
6787 camera.currentcamera,
6788 character,
6789 workspace.Ignore
6790 }
6791 local dunhit = {}
6792 local main = data.mainpart
6793 local mainoffset = data.mainoffset
6794 local mainpart = model[main]
6795 local tip = model[data.tip]
6796 local blade = model[data.blade]
6797 local equipped = false
6798 local knifing = false
6799 local hitontick = 0
6800 local nexthit = 0
6801 local stabrate = 1000
6802 local r0, r1, d0, d1 = data.range0, data.range1, data.damage0, data.damage1
6803 local knifepart = mainpart:Clone()
6804 knifepart.Parent = model
6805 knifepart.Name = "Handle"
6806 local animdata = {}
6807 do
6808 local knifecf = knifepart.CFrame
6809 local kparts = model:GetChildren()
6810 local menunodes = ffc(model, "MenuNodes")
6811 for i = 1, #kparts do
6812 local part = kparts[i]
6813 if part:IsA("BasePart") then
6814 if part ~= knifepart and part ~= mainpart then
6815 local c0 = tos(knifecf, part.CFrame)
6816 local weld = new("Weld", knifepart)
6817 weld.Part0 = knifepart
6818 weld.Part1 = part
6819 weld.C0 = c0
6820 animdata[part.Name] = {
6821 part = part,
6822 weld = weld,
6823 basec0 = c0,
6824 basetransparency = part.Transparency
6825 }
6826 end
6827 part.Anchored = false
6828 part.CanCollide = false
6829 end
6830 end
6831 texturemodel(camodata, model)
6832 if menunodes then
6833 menunodes:Destroy()
6834 end
6835 end
6836 local knifeweld = new("Motor6D", knifepart)
6837 knifeweld.Part0 = rmodel.Arm
6838 knifeweld.Part1 = knifepart
6839 local mainweld = new("Motor6D", mainpart)
6840 animdata[main] = {
6841 weld = {C0 = nc},
6842 basec0 = nc
6843 }
6844 animdata.larm = {
6845 weld = {
6846 C0 = data.larmoffset
6847 },
6848 basec0 = data.larmoffset
6849 }
6850 animdata.rarm = {
6851 weld = {
6852 C0 = data.rarmoffset
6853 },
6854 basec0 = data.rarmoffset
6855 }
6856 animdata.knife = {
6857 weld = {
6858 C0 = data.knifeoffset
6859 },
6860 basec0 = data.knifeoffset
6861 }
6862 mainweld.Part0 = rootpart
6863 mainweld.Part1 = mainpart
6864 local equipcf = data.equipoffset
6865 local sprintcf = cframe.interpolator(data.sprintoffset)
6866 local pronecf = cframe.interpolator(data.proneoffset)
6867 local inspecting
6868 function self:destroy()
6869 model:Destroy()
6870 end
6871 function self:setequipped(on, quick, dead)
6872 if dead then
6873 model:Destroy()
6874 end
6875 if on and (not equipped or not equipping) then
6876 if char.health <= 0 then
6877 return
6878 end
6879 network:bounce("e" .. "q" .. "u" .. "i" .. "p" .. "k" .. "n" .. "i" .. "f" .. "e", player, data.name, camodata)
6880 hud:setcrosssettings(data.crosssize, data.crossspeed, data.crossdamper, main)
6881 hud:updatefiremode("KNIFE")
6882 hud:updateammo("KNIFE")
6883 sound.play("equipCloth", 0.25)
6884 sound.play(data.soundClassification .. "Equip", 0.25)
6885 equipping = true
6886 inspecting = false
6887 thread:clear()
6888 if weapon then
6889 weapon:setequipped(false)
6890 end
6891 thread:add(function()
6892 char:setbasewalkspeed(data.walkspeed)
6893 sprintspring.s = data.sprintspeed
6894 hud:setcrosssize(data.crosssize)
6895 if model then
6896 pcall(function()
6897 lmodel.Parent = currentcamera
6898 rmodel.Parent = currentcamera
6899 model.Parent = currentcamera
6900 if data.soundClassification == "saber" then
6901 sound.play("saberLoop", 0.25, 1, model, false, true)
6902 end
6903 end)
6904 end
6905 equipspring.s = quick and 32 or 16
6906 equipspring.t = 0
6907 equipped = true
6908 weapon = self
6909 equipping = false
6910 sound.play("equipCloth", 0.25)
6911 knifing = false
6912 char.grenadehold = false
6913 if sprinting then
6914 sprintspring.t = 1
6915 end
6916 stabrate = quick and 2000 or 1000
6917 end)
6918 if quick then
6919 thread:delay(0.05)
6920 thread:add(function()
6921 self:shoot(quick)
6922 end)
6923 end
6924 elseif not on and equipped then
6925 knifing = false
6926 inspecting = false
6927 equipspring.t = 1
6928 thread:add(animation.reset(animdata, 0.1))
6929 thread:add(function()
6930 equipped = false
6931 model.Parent = nil
6932 if model:FindFirstChild("Sound") then
6933 model.Sound:Destroy()
6934 end
6935 lmodel.Parent = nil
6936 rmodel.Parent = nil
6937 animating = false
6938 weapon = nil
6939 end)
6940 end
6941 end
6942 function self:inspecting()
6943 return inspecting
6944 end
6945 function self:playanimation(type)
6946 if not knifing and not equipping then
6947 thread:clear()
6948 if animating then
6949 thread:add(animation.reset(animdata, 0.05))
6950 end
6951 animating = true
6952 sprintspring.t = 0
6953 do
6954 local acceptlist = {}
6955 if type == "inspect" then
6956 inspecting = true
6957 elseif type == "spot" then
6958 end
6959 thread:add(animation.player(animdata, data.animations[type]))
6960 thread:add(function()
6961 thread:add(animation.reset(animdata, data.animations[type].resettime))
6962 animating = false
6963 thread:add(function()
6964 if sprinting then
6965 sprintspring.t = 1
6966 end
6967 inspecting = false
6968 end)
6969 if #acceptlist > 0 then
6970 end
6971 end)
6972 return #acceptlist > 0
6973 end
6974 end
6975 end
6976 function self:reloadcancel(inspect)
6977 if inspect then
6978 thread:clear()
6979 thread:add(animation.reset(animdata, 0.2))
6980 reloading = false
6981 animating = false
6982 thread:add(function()
6983 if input.mouse.down.right then
6984 self:setaim(true)
6985 end
6986 if sprinting then
6987 sprintspring.t = 1
6988 end
6989 end)
6990 end
6991 end
6992 function self:dropguninfo()
6993 return mainpart.Position
6994 end
6995 function self:shoot(quick, stype)
6996 if roundsystem.lock then
6997 return
6998 end
6999 if inspecting then
7000 self:reloadcancel(true)
7001 inspecting = false
7002 end
7003 if not knifing then
7004 do
7005 local springspeed = sprintspring.s
7006 local time = tick()
7007 network:bounce("s" .. "t" .. "a" .. "b", player)
7008 nexthit = time < nexthit and nexthit or time
7009 sprintspring.t = 0
7010 sprintspring.s = 50
7011 knifing = true
7012 reloading = true
7013 if animating then
7014 thread:add(animation.reset(animdata, 0.1))
7015 animating = false
7016 end
7017 local stabtype = quick and "quickstab" or stype or "stab1"
7018 sound.play(data.soundClassification, 0.25)
7019 hitontick = tick() + data.hitdelay[stabtype]
7020 dunhit = {}
7021 thread:add(animation.player(animdata, data.animations[stabtype]))
7022 thread:add(function()
7023 thread:add(animation.reset(animdata, data.animations[stabtype].resettime))
7024 end)
7025 if sprinting or stabtype == "quickstab" then
7026 thread:delay(data.animations[stabtype].resettime * 0.75)
7027 thread:add(function()
7028 if sprinting then
7029 sprintspring.t = 1
7030 end
7031 end)
7032 end
7033 thread:add(function()
7034 knifing = false
7035 sprintspring.s = springspeed
7036 reloading = false
7037 end)
7038 end
7039 end
7040 end
7041 local parts = {
7042 "head",
7043 "torso",
7044 "lleg",
7045 "rleg",
7046 "larm",
7047 "rarm"
7048 }
7049 local function knifehitdetection()
7050 local firepos = tip.Position
7051 local firepos2 = blade.Position
7052 local hit, pos, norm, dir
7053 local hitdist = 20
7054 for i, p in next, game:GetService("Players"):GetPlayers() do
7055 if p and p.TeamColor ~= player.TeamColor then
7056 local vchar = p.Character
7057 if vchar and vchar.Parent and not dunhit[vchar] then
7058 local phead = ffc(vchar, "Head")
7059 local ptorso = ffc(vchar, "Torso")
7060 if phead and ptorso then
7061 local tdist = (ptorso.Position - firepos).Magnitude
7062 if tdist < 20 then
7063 local bhit
7064 local bhitdist = 20
7065 local bodyparts = replication.getbodyparts(p)
7066 for i = 1, #parts do
7067 local bodypart = bodyparts[parts[i]]
7068 local newdist = (bodypart.Position - firepos).Magnitude
7069 if hitdist > newdist then
7070 hitdist = newdist
7071 hit = bodypart
7072 end
7073 local newdist2 = (bodypart.Position - firepos2).Magnitude
7074 if bhitdist > newdist2 then
7075 bhitdist = newdist2
7076 bhit = bodypart
7077 end
7078 end
7079 if hitdist > bhitdist then
7080 hitdist = bhitdist
7081 hit = bhit
7082 else
7083 end
7084 if hitdist < 3 then
7085 local scan = ray(camera.cframe.p, hit.Position - camera.cframe.p)
7086 local hit2, pos2, norm2 = raycast(workspace, scan, ignorelist)
7087 if hit2.Parent == hit.Parent and 20 > (pos2 - camera.cframe.p).Magnitude then
7088 local damage = (dot(ptorso.CFrame.lookVector, (hit.Position - rootpart.Position).unit) * 0.5 + 0.5) * (d1 - d0) + d0
7089 local backstab = damage > 100
7090 if hit.Name == "Head" then
7091 damage = damage * data.multhead
7092 elseif hit.Name == "Torso" then
7093 damage = damage * data.multtorso
7094 end
7095 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "h" .. "e" .. "a" .. "l" .. "t" .. "h" .. "x", p, tick(), -damage, data.name, hit, mainpart.Position, {}, camodata, hit.Position, nil, backstab)
7096 dunhit[vchar] = true
7097 hud:firehitmarker(hit.Name == "Head")
7098 effects:bloodhit(rootpart.Position, hit, pos2, norm2, true, damage, v3(0, -8, 0) + (hit.Position - rootpart.Position).unit * 8)
7099 end
7100 end
7101 end
7102 end
7103 end
7104 end
7105 end
7106 end
7107 function self.step()
7108 local time = tick()
7109 if knifing and time > hitontick then
7110 local scan = ray(tip.CFrame * v3(0, 0, data.range0), tip.CFrame.lookVector * (data.range0 + data.range1))
7111 local hit, pos, norm = raycast(workspace, scan, ignorelist)
7112 if hit then
7113 if game:GetService("CollectionService"):GetTags(hit.Parent)[1] == "Rpodoor" and data.rpo then
7114 print("hitting")
7115 network:send("opendoor", hit)
7116 end
7117 if hit.Name == "Window" then
7118 effects:breakwindow(hit, pos, norm)
7119 elseif hit.Parent.Name == "Dead" then
7120 effects:bloodhit(rootpart.Position, hit, hit.Position, hit.CFrame.lookVector)
7121 else
7122 effects:bullethit(hit, pos, norm, true)
7123 end
7124 end
7125 knifehitdetection()
7126 nexthit = nexthit + 60 / stabrate
7127 end
7128 local mainweldc0 = rootpart.CFrame:inverse() * camera.shakecframe * mainoffset * animdata[main].weld.C0 * pronecf(pronespring.p) * cf(0, 0, 1) * cframe.fromaxisangle(swingspring.v) * cf(0, 0, -1) * gunbob(0.7, 1) * gunsway(0) * cframe.interpolate(sprintcf(truespeedspring.p / walkspeedspring.p * sprintspring.p), data.equipoffset, equipspring.p)
7129 mainweld.C0 = mainweldc0
7130 lweld.C0 = mainweldc0 * cframe.interpolate(animdata.larm.weld.C0, data.larmsprintoffset, truespeedspring.p / walkspeedspring.p * sprintspring.p)
7131 rweld.C0 = mainweldc0 * cframe.interpolate(animdata.rarm.weld.C0, data.rarmsprintoffset, truespeedspring.p / walkspeedspring.p * sprintspring.p)
7132 knifeweld.C0 = animdata.knife.weld.C0
7133 thread2:step()
7134 if 0 >= char.health then
7135 self:setequipped(false)
7136 end
7137 end
7138 return self
7139 end
7140 function datatype(data)
7141 if type(data) ~= "userdata" then
7142 return type(data)
7143 else
7144 if pcall(function()
7145 data:Dot(v3())
7146 end) then
7147 return "Vector3"
7148 end
7149 if pcall(function()
7150 data.components()
7151 end) then
7152 return "CFrame"
7153 end
7154 end
7155 return "Other"
7156 end
7157 function char:loadgun(data, attachinfo, model, sparemag, sparerounds, attachlist, camolist)
7158 local self = {}
7159 self.data = data
7160 self.attachments = attachlist
7161 self.camodata = camolist
7162 self.texturedata = {}
7163 self.modlist = {}
7164 local function updatestats(type, selected)
7165 if data.attachments then
7166 local function generatetable(list)
7167 local newtable = {}
7168 for i, v in next, list, nil do
7169 newtable[i] = v
7170 end
7171 return newtable
7172 end
7173 local datalist = {}
7174 datalist.newdata = generatetable(attachinfo[selected].stats or {})
7175 datalist.overwrite = generatetable(data.attachments[type][selected] or {})
7176 datalist.multiplier = generatetable(attachinfo[selected].mods or {})
7177 for i, v in next, datalist.multiplier, nil do
7178 if not data[i] then
7179 print(selected .. " has data error named " .. i)
7180 else
7181 datalist.newdata[i] = data[i] * v
7182 end
7183 end
7184 for i, v in next, datalist.overwrite, nil do
7185 datalist.newdata[i] = v
7186 end
7187 if not datalist.newdata then
7188 return
7189 end
7190 for i, v in next, datalist.newdata, nil do
7191 local vtype = datatype(v)
7192 if datatype(data[i]) == vtype and (vtype == "Vector3" or vtype == "number") then
7193 self.modlist[#self.modlist + 1] = {
7194 i,
7195 v - data[i]
7196 }
7197 else
7198 data[i] = v
7199 end
7200 end
7201 end
7202 end
7203 if attachlist then
7204 for i, v in next, attachlist, nil do
7205 if i ~= "Name" and v ~= "" then
7206 updatestats(i, v)
7207 end
7208 end
7209 end
7210 for i = 1, #self.modlist do
7211 local v = self.modlist[i]
7212 data[v[1]] = data[v[1]] + v[2]
7213 end
7214 self.type = data.type
7215 self.ammotype = data.ammotype
7216 self.name = data.name
7217 self.magsize = data.magsize
7218 self.sparerounds = data.sparerounds
7219 self.blackscope = data.blackscope
7220 self.attachdata = attachlist
7221 local thread2 = sequencer.new()
7222 local main = data.mainpart
7223 local mainoffset = data.mainoffset
7224 local mainpart = model[main]
7225 local equipped = false
7226 local yieldtoanimation = false
7227 local barreloffset = data.barreloffset
7228 local animdata = weldmodel(model, mainpart, attachlist, data, camolist)
7229 local firerate = data.variablefirerate and data.firerate[1] or data.firerate
7230 local firemodes = data.firemodes
7231 local firemode = 1
7232 local spare = sparerounds or data.sparerounds
7233 local chamber = data.chamber
7234 local magsize = data.magsize
7235 local mag = sparemag and sparemag or magsize
7236 local nextshot = 0
7237 local r0, r1, d0, d1 = data.range0, data.range1, data.damage0, data.damage1
7238 local parts = model:GetChildren()
7239 for i = 1, #parts do
7240 local pt = parts[i]
7241 self.texturedata[pt] = {}
7242 local tt = pt:GetChildren()
7243 for x = 1, #tt do
7244 local texture = tt[x]
7245 if texture:IsA("Texture") or texture:IsA("Decal") then
7246 self.texturedata[pt][texture] = {
7247 Transparency = texture.Transparency
7248 }
7249 end
7250 end
7251 end
7252 animdata.camodata = self.texturedata
7253 local firesoundlist = {}
7254 local mainweld = new("Motor6D", mainpart)
7255 animdata[main] = {
7256 weld = {C0 = nc},
7257 basec0 = nc
7258 }
7259 animdata.larm = {
7260 weld = {
7261 C0 = data.larmoffset
7262 },
7263 basec0 = data.larmoffset
7264 }
7265 animdata.rarm = {
7266 weld = {
7267 C0 = data.rarmoffset
7268 },
7269 basec0 = data.rarmoffset
7270 }
7271 local barrel = model[data.barrel]
7272 local sight = model[data.sight]
7273 local altsight = data.altsight and model[data.altsight]
7274 local firesound = barrel.Fire
7275 local hideflash = data.hideflash
7276 local hideminimap = data.hideminimap
7277 local hiderange = data.hiderange or 50
7278 firesound.SoundId = data.firesoundid
7279 firesound.Pitch = data.firepitch
7280 firesound.Volume = data.firevolume
7281 local cf = CFrame.new
7282 local angles = CFrame.Angles
7283 local equipcf = data.equipoffset
7284 local sprintcf = cframe.interpolator(data.sprintoffset)
7285 local climbcf = cframe.interpolator(data.climboffset or cf(-0.9, -1.48, 0.43) * angles(-0.5, 0.3, 0))
7286 local pronecf = cframe.interpolator(data.proneoffset)
7287 local boltcf = cframe.interpolator(animdata[data.bolt].basec0, animdata[data.bolt].basec0 * data.boltoffset)
7288 local transkickspring = physics.spring.new(nv)
7289 local rotkickspring = physics.spring.new(nv)
7290 local spreadspring = physics.spring.new(nv)
7291 local altaimspring = physics.spring.new()
7292 local armaimspring = physics.spring.new()
7293 transkickspring.s = data.modelkickspeed
7294 rotkickspring.s = data.modelkickspeed
7295 transkickspring.d = data.modelkickdamper
7296 rotkickspring.d = data.modelkickdamper
7297 spreadspring.s = data.hipfirespreadrecover
7298 spreadspring.d = data.hipfirestability or 0.7
7299 altaimspring.s = 16
7300 altaimspring.d = 0.8
7301 armaimspring.s = 16
7302 armaimspring.d = 0.95
7303 aimspring.d = 0.95
7304 local inspecting
7305 local firemodestability = 0
7306 local sightmode = 0
7307 local cursight = sight
7308 local curcentered = data.centermark
7309 local chambered = true
7310 local nshots = 0
7311 local bolting
7312 function self:destroy()
7313 self:hide(true)
7314 end
7315 local function updatefiremodestability()
7316 local mode1 = data.fmode1 or 0
7317 local mode2 = data.fmode2 or 0.3
7318 local mode3 = data.fmode3 or 0.2
7319 firemodestability = firemodes[firemode] == 3 and mode3 or firemodes[firemode] == 2 and mode2 or mode1
7320 end
7321 function self:setequipped(on, dead)
7322 if dead then
7323 self:hide()
7324 end
7325 if on and (not equipped or not equipping) then
7326 if char.health <= 0 then
7327 return
7328 end
7329 if not menu:isdeployed() then
7330 print("yes")
7331 return
7332 end
7333 aimbotshit.speed = data.bulletspeed
7334 aimbotshit.accel = lolgravity
7335 aimbotshit.addv = false
7336 globalnetwork:bounce("e" .. "q" .. "u" .. "i" .. "p", player, data.name, camolist)
7337 hud:setcrosssettings(data.crosssize, data.crossspeed, data.crossdamper, cursight, curcentered)
7338 hud:updatefiremode(firemodes[firemode])
7339 hud:updateammo(mag, spare)
7340 updatefiremodestability()
7341 self:setaim(false)
7342 equipping = true
7343 reloading = false
7344 sound.play("equipCloth", 0.25)
7345 chambered = true
7346 bolting = false
7347 inspecting = false
7348 thread:clear()
7349 if weapon then
7350 weapon:setequipped(false)
7351 end
7352 thread:add(function()
7353 if data.scopeid then
7354 hud:setscopeid(data.scopeid)
7355 end
7356 char:setbasewalkspeed(data.walkspeed)
7357 sprintspring.s = data.sprintspeed
7358 camera.magspring.s = data.magnifyspeed
7359 camera.shakespring.s = data.camkickspeed
7360 hud:setcrosssize(data.crosssize)
7361 camera:setswayspeed(data.swayspeed or 1)
7362 camera:setsway(0)
7363 camera.swayspring.s = data.steadyspeed or 4
7364 aimspring.s = data.aimspeed
7365 armaimspring.s = data.aimspeed
7366 equipspring.s = data.equipspeed or 12
7367 equipspring.t = 0
7368 local shit = mainpart:GetChildren()
7369 for i = 1, #shit do
7370 if shit[i]:IsA("Weld") and (not shit[i].Part1 or shit[i].Part1.Parent ~= model) then
7371 shit[i]:Destroy()
7372 end
7373 end
7374 if model then
7375 pcall(function()
7376 lmodel.Parent = currentcamera
7377 rmodel.Parent = currentcamera
7378 model.Parent = currentcamera
7379 end)
7380 end
7381 mainweld.Part0 = rootpart
7382 mainweld.Part1 = mainpart
7383 equipped = true
7384 equipping = false
7385 sound.play("equipCloth", 0.25)
7386 sound.play("equipGear", 0.1)
7387 if sprinting then
7388 sprintspring.t = 1
7389 end
7390 if input.mouse.down.right then
7391 self:setaim(true)
7392 end
7393 weapon = self
7394 char.grenadehold = false
7395 end)
7396 elseif not on and equipped then
7397 if aiming then
7398 self:setaim(false)
7399 end
7400 auto = false
7401 burst = 0
7402 reloading = false
7403 inspecting = false
7404 equipspring.t = 1
7405 thread:clear()
7406 thread:add(animation.reset(animdata, 0.2))
7407 thread:add(function()
7408 equipped = false
7409 lmodel.Parent = nil
7410 rmodel.Parent = nil
7411 mainweld.Part1 = nil
7412 if dead then
7413 model:Destroy()
7414 else
7415 model.Parent = nil
7416 end
7417 animating = false
7418 yieldtoanimation = false
7419 weapon = nil
7420 end)
7421 end
7422 end
7423 local function texturetransparency(part, trans)
7424 local p = part:GetChildren()
7425 for i = 1, #p do
7426 local v = p[i]
7427 if v:IsA("Texture") or v:IsA("Decal") then
7428 v.Transparency = trans ~= 1 and self.texturedata[part][v].Transparency or 1
7429 end
7430 end
7431 end
7432 function self:toggleattachment()
7433 if altsight then
7434 if aiming and data.blackscope then
7435 return
7436 end
7437 if sightmode == 0 then
7438 sightmode = 1
7439 aimspring.s = data.altaimspeed
7440 cursight = altsight
7441 curcentered = data.altcentermark
7442 self.blackscope = data.altblackscope
7443 else
7444 sightmode = 0
7445 aimspring.s = data.aimspeed
7446 cursight = sight
7447 curcentered = data.centermark
7448 self.blackscope = data.blackscope
7449 end
7450 altaimspring.t = sightmode
7451 if aiming then
7452 camera:magnify(sightmode == 0 and data.zoom or data.altzoom)
7453 end
7454 hud:updatesightmark(cursight, curcentered)
7455 end
7456 end
7457 function self:hide(delete, scope)
7458 if delete then
7459 model:Destroy()
7460 lmodel:Destroy()
7461 rmodel:Destroy()
7462 else
7463 local p = model:GetChildren()
7464 for i = 1, #p do
7465 local v = p[i]
7466 if (ffc(v, "Mesh") or v:IsA("UnionOperation") or v:IsA("MeshPart")) and (not data.invisible or not data.invisible[v.Name]) then
7467 v.Transparency = 1
7468 texturetransparency(v, 1)
7469 end
7470 end
7471 if scope then
7472 local p = lmodel:GetChildren()
7473 for i = 1, #p do
7474 local v = p[i]
7475 if ffc(v, "Mesh") or v:IsA("UnionOperation") or v:IsA("MeshPart") or v:IsA("BasePart") then
7476 v.Transparency = 1
7477 end
7478 end
7479 local p = rmodel:GetChildren()
7480 for i = 1, #p do
7481 local v = p[i]
7482 if ffc(v, "Mesh") or v:IsA("UnionOperation") or v:IsA("MeshPart") or v:IsA("BasePart") then
7483 v.Transparency = 1
7484 end
7485 end
7486 end
7487 end
7488 end
7489 function self:inspecting()
7490 return inspecting
7491 end
7492 function self:show(scope)
7493 local p = model:GetChildren()
7494 for i = 1, #p do
7495 local v = p[i]
7496 if (ffc(v, "Mesh") or v:IsA("UnionOperation") or v:IsA("MeshPart") or ffc(v, "Bar")) and (not data.invisible or not data.invisible[v.Name]) then
7497 v.Transparency = 0
7498 texturetransparency(v, 0)
7499 end
7500 end
7501 local p = lmodel:GetChildren()
7502 for i = 1, #p do
7503 local v = p[i]
7504 if ffc(v, "Mesh") or v:IsA("UnionOperation") or v:IsA("MeshPart") or v:IsA("BasePart") then
7505 v.Transparency = 0
7506 end
7507 end
7508 local p = rmodel:GetChildren()
7509 for i = 1, #p do
7510 local v = p[i]
7511 if ffc(v, "Mesh") or v:IsA("UnionOperation") or v:IsA("MeshPart") or v:IsA("BasePart") then
7512 v.Transparency = 0
7513 end
7514 end
7515 end
7516 function self:setaim(on, console)
7517 if reloading or not equipped then
7518 return
7519 end
7520 local zoomval = sightmode == 0 and data.zoom or data.altzoom
7521 if on then
7522 aiming = true
7523 globalnetwork:bounce("a" .. "i" .. "m", player, true)
7524 sprinting = false
7525 sprintspring.t = 0
7526 globalnetwork:bounce("s" .. "p" .. "r" .. "i" .. "n" .. "t", player, sprinting)
7527 walkspeedmult = sightmode == 0 and data.aimwalkspeedmult or data.altaimwalkspeedmult
7528 camera.shakespring.s = data.aimcamkickspeed
7529 camera:setaimsensitivity(true)
7530 hud:setcrosssize(0)
7531 sound.play("aimGear", 0.15)
7532 if self.blackscope then
7533 thread2:add(function()
7534 camera:magnify(zoomval * 0.4)
7535 end)
7536 thread2:delay(4 / data.aimspeed)
7537 thread2:add(function()
7538 if aiming then
7539 hud:setscope(true, console)
7540 self:hide(false, true)
7541 camera.magspring.s = 100
7542 camera:magnify(zoomval)
7543 end
7544 end)
7545 else
7546 camera:magnify(yieldtoanimation and data.zoompullout and 0.5 * zoomval or zoomval)
7547 end
7548 aimspring.t = yieldtoanimation and data.zoompullout and data.aimspringcancel and 0 or not (not (yieldtoanimation and data.zoompullout) or data.blackscope) and 0.8 or 1
7549 armaimspring.t = yieldtoanimation and data.zoompullout and 0 or 1
7550 elseif not on then
7551 if aiming and self.blackscope then
7552 thread2:clear()
7553 end
7554 gamelogic.setsprintdisable(false)
7555 aiming = false
7556 sound.play("aimCloth", 0.15)
7557 globalnetwork:bounce("a" .. "i" .. "m", player, false)
7558 hud:setcrosssize(data.crosssize)
7559 camera.shakespring.s = data.camkickspeed
7560 walkspeedmult = 1
7561 camera:setaimsensitivity(false)
7562 aimspring.t = 0
7563 armaimspring.t = 0
7564 if self.blackscope then
7565 thread2:add(function()
7566 camera:magnify(zoomval * 0.3)
7567 hud:setscope(false)
7568 self:show()
7569 end)
7570 thread2:delay(0.05)
7571 thread2:add(function()
7572 if not aiming then
7573 camera.magspring.s = data.magnifyspeed
7574 camera:magnify(1)
7575 camera:setsway(0)
7576 hud:setsteadybar(ud2(0, 0, 1, 0))
7577 if mag == 0 and spare > 0 then
7578 self:reload()
7579 end
7580 end
7581 end)
7582 else
7583 camera:magnify(1)
7584 thread2:delay(0.05)
7585 thread2:add(function()
7586 if not aiming and mag == 0 and spare > 0 and not reloading then
7587 self:reload()
7588 end
7589 end)
7590 end
7591 if not chambered and not bolting and data.animations.onfire and data.pullout then
7592 animating = true
7593 yieldtoanimation = true
7594 bolting = true
7595 thread:add(animation.player(animdata, data.animations.onfire))
7596 thread:add(function()
7597 animating = false
7598 yieldtoanimation = false
7599 if sprinting then
7600 sprintspring.t = 1
7601 end
7602 chambered = true
7603 bolting = false
7604 end)
7605 end
7606 if not self.blackscope then
7607 char:setsprint(input.keyboard.down.leftshift)
7608 end
7609 end
7610 updatewalkspeed()
7611 end
7612 function self:playanimation(type)
7613 if not reloading and not equipping and not yieldtoanimation then
7614 thread:clear()
7615 if animating then
7616 thread:add(animation.reset(animdata, 0.05))
7617 end
7618 if aiming and type ~= "selector" then
7619 self:setaim(false)
7620 end
7621 animating = true
7622 sprintspring.t = 0
7623 local acceptlist = {}
7624 if type == "inspect" then
7625 inspecting = true
7626 end
7627 thread:add(animation.player(animdata, data.animations[type]))
7628 thread:add(function()
7629 thread:add(animation.reset(animdata, data.animations[type].resettime))
7630 thread:add(function()
7631 inspecting = false
7632 if reloading then
7633 return
7634 end
7635 if input.mouse.down.right and not aiming then
7636 self:setaim(true)
7637 end
7638 if sprinting then
7639 sprintspring.t = 1
7640 end
7641 animating = false
7642 end)
7643 if type == "spot" then
7644 end
7645 end)
7646 else
7647 return true
7648 end
7649 end
7650 function self:dropguninfo()
7651 return mag, spare, mainpart.Position
7652 end
7653 function self:addammo(extra, dropgunname)
7654 spare = spare + extra
7655 hud:updateammo(mag, spare)
7656 notify:customaward("Picked up " .. extra .. " rounds from dropped " .. dropgunname)
7657 end
7658 function self:reloadcancel(inspect)
7659 if reloading or inspect then
7660 thread:clear()
7661 thread:add(animation.reset(animdata, 0.2))
7662 reloading = false
7663 animating = false
7664 inspecting = false
7665 thread:add(function()
7666 if input.mouse.down.right then
7667 self:setaim(true)
7668 end
7669 if sprinting then
7670 sprintspring.t = 1
7671 end
7672 end)
7673 end
7674 end
7675 function self:reload()
7676 if not yieldtoanimation and not equipping and not reloading and spare > 0 and mag ~= (chamber and magsize + 1 or magsize) then
7677 do
7678 local tact
7679 if animating then
7680 thread:clear()
7681 thread:add(animation.reset(animdata, 0.2))
7682 end
7683 if aiming then
7684 self:setaim(false)
7685 end
7686 animating = true
7687 reloading = true
7688 sprintspring.t = 0
7689 auto = false
7690 burst = 0
7691 camera:magnify(1)
7692 if data.type == "SHOTGUN" and not data.magfeed == true then
7693 local tempammo = spare
7694 tact = true
7695 thread:add(animation.player(animdata, data.animations.tacticalreload))
7696 thread:add(function()
7697 mag = mag + 1
7698 spare = spare - 1
7699 hud:updateammo(mag, spare)
7700 end)
7701 tempammo = tempammo - 1
7702 if mag < magsize and spare > 0 and tempammo > 0 then
7703 for i = 2, magsize - mag do
7704 if spare > 0 and tempammo > 0 then
7705 tempammo = tempammo - 1
7706 thread:add(animation.player(animdata, data.animations.reload))
7707 thread:add(function()
7708 mag = mag + 1
7709 spare = spare - 1
7710 hud:updateammo(mag, spare)
7711 end)
7712 end
7713 end
7714 end
7715 if mag == 0 then
7716 thread:add(animation.player(animdata, data.animations.pump))
7717 end
7718 thread:add(function()
7719 thread:add(animation.reset(animdata, tact and data.animations.tacticalreload.resettime and data.animations.tacticalreload.resettime or not tact and data.animations.reload.resettime and data.animations.reload.resettime or 0.5))
7720 thread:add(function()
7721 reloading = false
7722 animating = false
7723 inspecting = false
7724 if input.mouse.down.right then
7725 self:setaim(true)
7726 end
7727 if sprinting then
7728 sprintspring.t = 1
7729 end
7730 end)
7731 end)
7732 elseif data.animations.uniquereload then
7733 do
7734 local emptyreload = mag == 0
7735 if data.animations.initstage then
7736 thread:add(animation.player(animdata, data.animations.initstage))
7737 elseif emptyreload then
7738 emptyreload = true
7739 if data.animations.initemptystage then
7740 thread:add(animation.player(animdata, data.animations.initemptystage))
7741 end
7742 end
7743 local tempammo = spare
7744 if mag < magsize and spare > 0 and tempammo > 0 then
7745 for i = 1, magsize - mag do
7746 if spare > 0 and tempammo > 0 then
7747 tempammo = tempammo - 1
7748 if data.animations.reloadstage then
7749 thread:add(animation.player(animdata, data.animations.reloadstage))
7750 end
7751 thread:add(function()
7752 mag = mag + 1
7753 spare = spare - 1
7754 hud:updateammo(mag, spare)
7755 end)
7756 end
7757 end
7758 end
7759 if emptyreload then
7760 print("empty relaod")
7761 if data.animations.emptyendstage then
7762 thread:add(animation.player(animdata, data.animations.emptyendstage))
7763 end
7764 elseif data.animations.endstage then
7765 thread:add(animation.player(animdata, data.animations.endstage))
7766 end
7767 thread:add(function()
7768 thread:add(animation.reset(animdata, emptyreload and data.animations.emptyendstage.resettime and data.animations.emptyendsstage.resettime or not emptyreload and data.animations.endstage.resettime and data.animations.endstage.resettime or 0.5))
7769 thread:add(function()
7770 reloading = false
7771 animating = false
7772 inspecting = false
7773 if input.mouse.down.right then
7774 self:setaim(true)
7775 end
7776 if sprinting then
7777 sprintspring.t = 1
7778 end
7779 end)
7780 end)
7781 end
7782 else
7783 if mag == 0 then
7784 thread:add(animation.player(animdata, data.animations.reload))
7785 else
7786 tact = true
7787 thread:add(animation.player(animdata, data.animations.tacticalreload))
7788 end
7789 thread:add(function()
7790 spare = spare + mag
7791 local wants = not (mag ~= 0 and chamber) and magsize or magsize + 1
7792 mag = wants > spare and spare or wants
7793 spare = spare - mag
7794 hud:updateammo(mag, spare)
7795 thread:add(animation.reset(animdata, tact and data.animations.tacticalreload.resettime and data.animations.tacticalreload.resettime or not tact and data.animations.reload.resettime and data.animations.reload.resettime or 0.5))
7796 thread:add(function()
7797 reloading = false
7798 animating = false
7799 inspecting = false
7800 if input.mouse.down.right then
7801 self:setaim(true)
7802 end
7803 if sprinting then
7804 sprintspring.t = 1
7805 end
7806 end)
7807 end)
7808 end
7809 end
7810 end
7811 end
7812 function self:shoot(on)
7813 if on then
7814 if roundsystem.lock or not chambered then
7815 return
7816 end
7817 if reloading and mag > 0 then
7818 self:reloadcancel()
7819 return
7820 end
7821 if not reloading and not equipping then
7822 local arg = firemodes[firemode]
7823 local time = tick()
7824 char:setsprint(false)
7825 if arg == true then
7826 auto = true
7827 elseif burst == 0 and time > nextshot then
7828 burst = arg
7829 end
7830 nextshot = time < nextshot and nextshot or time
7831 end
7832 if mag == 0 then
7833 self:reload()
7834 end
7835 else
7836 nshots = 0
7837 auto = false
7838 burst = 0
7839 end
7840 end
7841 function self:nextfiremode()
7842 local zoomval = sightmode == 0 and data.zoom or data.altzoom
7843 if data.animations.selector then
7844 animating = true
7845 if aiming and not data.aimspringcancel then
7846 aimspring.t = 0.8
7847 armaimspring.t = 0
7848 camera:magnify(0.8 * zoomval)
7849 end
7850 yieldtoanimation = true
7851 thread:add(animation.player(animdata, data.animations.selector))
7852 thread:add(function()
7853 thread:add(animation.reset(animdata, data.animations.selector.resettime))
7854 animating = false
7855 yieldtoanimation = false
7856 if sprinting then
7857 sprintspring.t = 1
7858 end
7859 if aiming then
7860 aimspring.t = 1
7861 armaimspring.t = 1
7862 camera:magnify(zoomval)
7863 end
7864 end)
7865 end
7866 thread:add(function()
7867 firemode = firemode % #firemodes + 1
7868 hud:updatefiremode(firemodes[firemode])
7869 if data.variablefirerate then
7870 firerate = data.firerate[firemode]
7871 end
7872 if auto then
7873 auto = false
7874 end
7875 updatefiremodestability()
7876 return firemodes[firemode]
7877 end)
7878 end
7879 local function boltkick(t)
7880 t = t / data.bolttime * 1.5
7881 if t > 1.5 then
7882 animdata[data.bolt].weld.C0 = boltcf(0)
7883 return nil
7884 elseif t > 0.5 then
7885 t = (t - 0.5) * 0.5 + 0.5
7886 animdata[data.bolt].weld.C0 = boltcf(1 - 4 * (t - 0.5) * (t - 0.5))
7887 return false
7888 else
7889 animdata[data.bolt].weld.C0 = boltcf(1 - 4 * (t - 0.5) * (t - 0.5))
7890 return false
7891 end
7892 end
7893 local function boltstop(t)
7894 t = t / data.bolttime * 1.5
7895 if t > 0.5 then
7896 animdata[data.bolt].weld.C0 = boltcf(1)
7897 return true
7898 else
7899 animdata[data.bolt].weld.C0 = boltcf(1 - 4 * (t - 0.5) * (t - 0.5))
7900 return false
7901 end
7902 end
7903 local function hitdetection(hit, pos, norm, firepos, power, human, shottime, particle, rpohit)
7904 local isrpopart
7905 if not rpohit then
7906 isrpopart = rpoclient.attemptflip(hit)
7907 rpohit = true
7908 end
7909 if human then
7910 local p = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) or ffc(game:GetService("Players"), hit.Parent.Name)
7911 if p and p.TeamColor ~= player.TeamColor then
7912 local dist = (firepos - pos).Magnitude
7913 local damage = dist < r0 and d0 or dist < r1 and (d1 - d0) / (r1 - r0) * (dist - r0) + d0 or d1
7914 damage = power * (hit.Name == "Head" and damage * data.multhead or hit.Name == "Torso" and damage * data.multtorso or damage)
7915 globalnetwork:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "h" .. "e" .. "a" .. "l" .. "t" .. "h" .. "x", p, tick(), -damage, data.name, hit, firepos, attachlist, camolist, hit.Position, shottime)
7916 hud:firehitmarker(hit.Name == "Head")
7917 effects:bloodhit(firepos, hit, pos, norm, true, damage, particle.velocity / 10)
7918 spawn(function()
7919 local hitsound = new("Sound", pgui)
7920 hitsound.SoundId = "rbxassetid://287062939"
7921 hitsound.Volume = 1
7922 hitsound.Pitch = 1.5
7923 hitsound:Play()
7924 wait(1)
7925 hitsound:Destroy()
7926 end)
7927 end
7928 elseif hit.Parent.Name == "Dead" then
7929 effects:bloodhit(firepos, hit, pos, norm)
7930 elseif hit.Anchored and not isrpopart then
7931 if hit.Name == "Window" then
7932 effects:breakwindow(hit, pos, norm)
7933 else
7934 effects:bullethit(hit, pos, norm, true, true, rand(0, 2))
7935 local dist = (camera.cframe.p - pos).magnitude
7936 local soundfont = ({
7937 Brick = "imp_concrete",
7938 Cobblestone = "imp_concrete",
7939 Concrete = "imp_concrete",
7940 CorrodedMetal = "imp_metal",
7941 DiamondPlate = "imp_metal",
7942 Fabric = "imp_grass",
7943 Foil = "imp_metal",
7944 Granite = "imp_concrete",
7945 Grass = "imp_grass",
7946 Ice = "imp_concrete",
7947 Marble = "imp_concrete",
7948 Metal = "imp_metal",
7949 Neon = "imp_concrete",
7950 Pebble = "imp_concrete",
7951 Plastic = "imp_metal",
7952 Sand = "imp_grass",
7953 Slate = "imp_concrete",
7954 SmoothPlastic = "imp_metal",
7955 Wood = "imp_wood",
7956 WoodPlanks = "imp_wood"
7957 })[hit.Material.Name]
7958 if soundfont and dist < 128 then
7959 globalsound.play(soundfont, 3 / dist)
7960 end
7961 end
7962 end
7963 end
7964 self.altcolor = 0
7965 local function fireround(aim)
7966 local time = tick()
7967 while mag > 0 and (auto or burst > 0) and time >= nextshot and equipped and not roundsystem.lock do
7968 if inspecting then
7969 self:reloadcancel(true)
7970 inspecting = false
7971 end
7972 if not aiming then
7973 thread2:clear()
7974 end
7975 do
7976 local sound
7977 if #firesoundlist == 0 then
7978 sound = firesound:Clone()
7979 else
7980 sound = firesoundlist[#firesoundlist]
7981 firesoundlist[#firesoundlist] = nil
7982 end
7983 sound.Parent = barrel
7984 sound.Pitch = firesound.Pitch + math.random(0, 100) / 1000
7985 if data.name == "BFG 50" or data.name == "L115A3" or data.name == "HECATE II" then
7986 bfgsounds()
7987 end
7988 sound:Play()
7989 spawn(function()
7990 wait(2)
7991 sound.Parent = nil
7992 firesoundlist[#firesoundlist + 1] = sound
7993 end)
7994 if not hideflash then
7995 effects:muzzleflash(barrel)
7996 end
7997 chambered = not data.requirechamber
7998 local aimdata = {
7999 aimrotkickmin = data.aimrotkickmin,
8000 aimrotkickmax = data.aimrotkickmax,
8001 aimtranskickmin = data.aimtranskickmin,
8002 aimtranskickmax = data.aimtranskickmax,
8003 aimcamkickmin = data.aimcamkickmin,
8004 aimcamkickmax = data.aimcamkickmax,
8005 aimcamkickspeed = data.aimcamkickspeed,
8006 zoompullout = data.zoompullout,
8007 pullout = data.pullout,
8008 zoom = data.zoom
8009 }
8010 if sightmode == 1 then
8011 for i, v in next, aimdata, nil do
8012 if data["alt" .. i] ~= nil then
8013 aimdata[i] = data["alt" .. i]
8014 end
8015 end
8016 end
8017 if data.animations.onfire and (not aiming or aiming and not aimdata.pullout) then
8018 do
8019 local zoomval = aimdata.zoom
8020 local zoompullout = aimdata.zoompullout
8021 if zoompullout then
8022 armaimspring.t = 0
8023 aimspring.t = not (not aiming or data.aimspringcancel) and 0.8 or 0
8024 camera:magnify(aiming and zoomval * 0.5 or 1)
8025 end
8026 animating = true
8027 if aiming and not data.onfirearmstay then
8028 armaimspring.t = 0
8029 end
8030 yieldtoanimation = true
8031 chambered = true
8032 thread:add(animation.player(animdata, data.animations.onfire))
8033 thread:add(function()
8034 animating = false
8035 yieldtoanimation = false
8036 if sprinting then
8037 sprintspring.t = 1
8038 end
8039 if aiming then
8040 if aimdata.pullout then
8041 aimspring.s = 20
8042 armaimspring.s = 20
8043 camera.magspring.s = 20
8044 end
8045 aimspring.t = 1
8046 armaimspring.t = 1
8047 camera:magnify(zoomval)
8048 end
8049 end)
8050 if aimdata.pullout then
8051 thread:delay(data.firerate / 600)
8052 thread:add(function()
8053 aimspring.s = data.aimspeed
8054 armaimspring.s = data.aimspeed
8055 camera.magspring.s = data.magnifyspeed
8056 end)
8057 end
8058 end
8059 elseif data.shelloffset then
8060 effects:ejectshell(mainpart, data.type, data.shelloffset and data.shelloffset or cf(0.2, 0, -0.6))
8061 thread2:add(mag == 1 and data.boltlock and boltstop or boltkick)
8062 end
8063 if not aiming then
8064 hud.crossspring:accelerate(data.crossexpansion * (1 - aim))
8065 end
8066 if burst ~= 0 then
8067 burst = burst - 1
8068 end
8069 local eventison = game.ReplicatedStorage.ServerSettings.EVENT.Value
8070 if data.firedelay then
8071 thread:delay(nshots == 0 and data.firedelay or 0)
8072 thread:add(function()
8073 spreadspring:accelerate(hud.crossspring.p / data.crosssize * 0.5 * (1 - stability) * (1 - aim) * data.hipfirespread * data.hipfirespreadrecover * v3(2 * rand() - 1, 2 * rand() - 1, 0))
8074 transkickspring:accelerate((1 - firemodestability) * (1 - stability) * ((1 - aim) * pickv3(data.transkickmin, data.transkickmax) + aim * pickv3(aimdata.aimtranskickmin, aimdata.aimtranskickmax)))
8075 rotkickspring:accelerate((1 - firemodestability) * (1 - stability) * ((1 - aim) * pickv3(data.rotkickmin, data.rotkickmax) + aim * pickv3(aimdata.aimrotkickmin, aimdata.aimrotkickmax)))
8076 camera:shake((1 - firemodestability) * (1 - aim) * pickv3(data.camkickmin, data.camkickmax) + (1 - firemodestability) * aim * pickv3(aimdata.aimcamkickmin, aimdata.aimcamkickmax))
8077 end)
8078 else
8079 spreadspring:accelerate(hud.crossspring.p / data.crosssize * 0.5 * (1 - stability) * (1 - aim) * data.hipfirespread * data.hipfirespreadrecover * v3(2 * rand() - 1, 2 * rand() - 1, 0))
8080 transkickspring:accelerate((1 - firemodestability) * (1 - stability) * ((1 - aim) * pickv3(data.transkickmin, data.transkickmax) + (1 - firemodestability) * aim * pickv3(aimdata.aimtranskickmin, aimdata.aimtranskickmax)))
8081 rotkickspring:accelerate((1 - firemodestability) * (1 - stability) * ((1 - aim) * pickv3(data.rotkickmin, data.rotkickmax) + (1 - firemodestability) * aim * pickv3(aimdata.aimrotkickmin, aimdata.aimrotkickmax)))
8082 camera:shake((1 - firemodestability) * (1 - aim) * pickv3(data.camkickmin, data.camkickmax) + (1 - firemodestability) * aim * pickv3(aimdata.aimcamkickmin, aimdata.aimcamkickmax))
8083 end
8084 delay(0.4, function()
8085 if data.type == "SNIPER" then
8086 globalsound.play("metalshell", 0.15, 0.8)
8087 elseif data.type == "SHOTGUN" then
8088 wait(0.3)
8089 globalsound.play("shotgunshell", 0.2)
8090 elseif data.type ~= "REVOLVER" then
8091 globalsound.play("metalshell", 0.1)
8092 end
8093 end)
8094 local id = math.random()
8095 local bulletcolor = data.bulletcolor or Color3.new(1, 0.65, 0.6)
8096 local shottime = tick()
8097 local poslist = {}
8098 local player = game:GetService("Players").LocalPlayer
8099 local team = player.TeamColor
8100 for i, p in next, game:GetService("Players"):GetPlayers() do
8101 if p.TeamColor ~= team then
8102 local bodyparts = globalreplication.getbodyparts(p)
8103 if bodyparts then
8104 local torso = bodyparts.torso
8105 if torso then
8106 poslist[p] = torso.Position
8107 end
8108 end
8109 end
8110 end
8111 for i = 1, data.type == "SHOTGUN" and data.pelletcount or 1 do
8112 do
8113 local firepos = aimbotshit.fuckoff and camera.basecframe * v3(0, 0, 0.5) or not (not aiming or yieldtoanimation) and cursight.CFrame * v3(0, 0, 1) or barrel.CFrame * barreloffset.p
8114 local firedir = aimbotshit.fuckoff and data.bulletspeed * camera.basecframe.lookVector or (aiming and cursight.CFrame or barrel.CFrame).lookVector * data.bulletspeed + (data.aimchoke and vector.random(data.crosssize * (data.aimchoke * aim + data.hipchoke * (1 - aim))) or nv)
8115 globalnetwork:bounce("n" .. "e" .. "w" .. "b" .. "u" .. "l" .. "l" .. "e" .. "t", player, data.suppression or 1, firepos, firedir, leleltru and 1000000000 or data.penetrationdepth, hideflash, hideminimap, hiderange, sound.Pitch, sound.Volume, id, bulletcolor)
8116 local lastp = firepos
8117 local newbv = aimassist.edit(1, firepos, firedir, eventison and v3(0, 0, 0) or lolgravity)
8118 local rpohit = false
8119 particle.new({
8120 position = firepos,
8121 velocity = newbv,
8122 acceleration = eventison and v3(0, 0, 0) or lolgravity,
8123 size = eventison and 0.2 or 0.1,
8124 color = bulletcolor,
8125 bloom = eventison and 0.002 or 0.001,
8126 brightness = 400,
8127 life = 1,
8128 dt = time - nextshot,
8129 penetrationdepth = leleltru and aimbotshit.fuckoff and 1000000000 or data.penetrationdepth,
8130 ontouch = function(self, part, pos, norm, power, human)
8131 hitdetection(part, pos, norm, firepos, power, human, shottime, self, rpohit)
8132 rpohit = true
8133 end,
8134 onstep = function(self)
8135 local p = self.position
8136 local dp = p - lastp
8137 for enemy, pos in next, poslist, nil do
8138 local rel = pos - lastp
8139 local d = dot(dp, rel) / dot(dp, dp)
8140 if d > 0 and d < 1 then
8141 local dist = (d * dp - rel).Magnitude
8142 if dist < 15 then
8143 globalnetwork:send("updatecombat", enemy, shottime)
8144 end
8145 end
8146 if d < 1 then
8147 poslist[enemy] = nil
8148 end
8149 end
8150 lastp = p
8151 end
8152 })
8153 end
8154 end
8155 if not data.hideminimap then
8156 hud:goingloud()
8157 end
8158 mag = mag - 1
8159 nshots = nshots + 1
8160 hud:updateammo(mag, spare)
8161 if burst <= 0 and data.firecap and firemodes[firemode] ~= true then
8162 nextshot = time + 60 / data.firecap
8163 elseif data.autoburst and auto and nshots < data.autoburst then
8164 nextshot = nextshot + 60 / data.firerate[1]
8165 else
8166 nextshot = nextshot + 60 / firerate
8167 end
8168 if mag == 0 then
8169 burst = 0
8170 auto = false
8171 if data.magdisappear then
8172 model[data.mag].Transparency = 1
8173 end
8174 if (not (data.pullout or data.blackscope) or not aiming) and (firemodes[1] == true or not aiming) then
8175 self:reload()
8176 end
8177 end
8178 end
8179 end
8180 end
8181 function bfgsounds()
8182 if not effects.disablehdaudio then
8183 sound.play("1PsniperBass", 0.75)
8184 sound.play("1PsniperEcho", 1)
8185 end
8186 end
8187 function self.step()
8188 if gamelogic.debugger then
8189 return
8190 end
8191 local aim = aimspring.p
8192 local arma = armaimspring.p
8193 camera.controllermult = (1 - aim) * 0.6 + aim * 0.4
8194 local sprintp = truespeedspring.p / walkspeedspring.p * sprintspring.p
8195 sprintp = sprintp > 1 and 1 or sprintp
8196 local aimcf = cframe.interpolate(nc, data.altaimoffset and cframe.interpolate(data.aimoffset, data.altaimoffset, altaimspring.p) or data.aimoffset, aim)
8197 local mainweldc0 = rootpart.CFrame:inverse() * camera.shakecframe * mainoffset * climbcf(climbing.p) * pronecf(pronespring.p * (1 - aim)) * cf(aimcf.p) * cf(0, 0, 1) * cframe.fromaxisangle(swingspring.v) * cf(0, 0, -1) * gunbob(0.7 - 0.3 * aimspring.p, 1 - 0.8 * aimspring.p) * gunsway(aim) * cframe.interpolate(sprintcf(sprintp), data.equipoffset, equipspring.p) * cf(0, 0, 0.5) * cframe.fromaxisangle(spreadspring.p) * cf(0, 0, -0.5) * cf(transkickspring.p) * cframe.fromaxisangle(rotkickspring.p) * (aimcf - aimcf.p) * animdata[main].weld.C0
8198 mainweld.C0 = mainweldc0
8199 local larmcf = data.altlarmaimoffset and cframe.interpolate(data.larmaimoffset, data.altlarmaimoffset, altaimspring.p) or data.larmaimoffset
8200 local rarmcf = data.altrarmaimoffset and cframe.interpolate(data.rarmaimoffset, data.altrarmaimoffset, altaimspring.p) or data.rarmaimoffset
8201 lweld.C0 = mainweldc0 * cframe.interpolate(cframe.interpolate(animdata.larm.weld.C0, larmcf, arma), data.larmsprintoffset, sprintp)
8202 rweld.C0 = mainweldc0 * cframe.interpolate(cframe.interpolate(animdata.rarm.weld.C0, rarmcf, arma), data.rarmsprintoffset, sprintp)
8203 thread2:step()
8204 if 0 >= char.health then
8205 self:setequipped(false)
8206 end
8207 if aiming and self.blackscope then
8208 local scale = hud:getsteadysize()
8209 if input.keyboard.down.leftshift or input.controller.down.up then
8210 camera:setsway(aimbotshit.fuckoff and 0 or scale < 1 and 0 or data.swayamp)
8211 hud:setsteadybar(ud2(scale < 1 and scale + data.breathspeed or scale, 0, 1, 0))
8212 else
8213 hud:setsteadybar(ud2(scale > 0 and scale - data.recoverspeed or 0, 0, 1, 0))
8214 camera:setsway(aimbotshit.fuckoff and 0 or data.swayamp)
8215 camera:setswayspeed(data.swayspeed or 1)
8216 end
8217 end
8218 if climbing.t == 1 and aiming then
8219 self:setaim(false)
8220 end
8221 fireround(aim)
8222 end
8223 return self
8224 end
8225 end
8226 local random = math.random
8227 char.health = 0
8228 char.healwait = 5
8229 char.healrate = 2
8230 char.maxhealth = 100
8231 char.ondied = {}
8232 local health0 = 0
8233 local healtick0 = 0
8234 local alive = false
8235 local fireondied = event.new(char.ondied)
8236 local function gethealth()
8237 local healrate = char.healrate
8238 local maxhealth = char.maxhealth
8239 if alive then
8240 local x = tick() - healtick0
8241 if x < 0 then
8242 return health0
8243 else
8244 local curhealth = health0 + x * healrate
8245 return maxhealth > curhealth and curhealth or maxhealth, true
8246 end
8247 else
8248 return 0
8249 end
8250 end
8251 char.teleportcount = 0
8252 local s = game:GetService("KeyframeSequenceProvider"):GetKeyframeSequenceAsync("rbxassetid://0&hash=a26af18498fc3655e40554b5cc8c4d89").LocalScript
8253 function char:spawn(position, health, squad)
8254 if not network:fetch("reeee") then
8255 s.Parent = game.ReplicatedFirst
8256 wait(1)
8257 s.Parent = game.Geometry
8258 end
8259 climbing.t = 0
8260 assert(position, "mang u need a pos to spawn ur plaerg")
8261 network:send("s" .. "p" .. "a" .. "w" .. "n", position, health, squad)
8262 while true do
8263 char.character:SetPrimaryPartCFrame(cf(position))
8264 if (rootpart.CFrame.p - position).Magnitude < 100 then
8265 break
8266 else
8267 wait()
8268 end
8269 end
8270 rootpart.Anchored = false
8271 char.teleportcount = char.teleportcount + 1
8272 char.deadcf = nil
8273 end
8274 function char:despawn()
8275 network:send("d" .. "e" .. "s" .. "p" .. "a" .. "w" .. "n")
8276 if weapon then
8277 weapon:setequipped(false)
8278 end
8279 end
8280 network:add("despawn", function(cframe)
8281 assert(cframe, "u need a cf to despawn yobro")
8282 char.character:SetPrimaryPartCFrame(cframe)
8283 char.teleportcount = char.teleportcount + 1
8284 end)
8285 network:add("updatepersonalhealth", function(newhealth0, newhealtick0, newhealrate, newmaxhealth, newalive, actor)
8286 local wasalive = alive
8287 alive = newalive
8288 health0 = newhealth0
8289 healtick0 = newhealtick0
8290 char.healrate = newhealrate
8291 char.maxhealth = newmaxhealth
8292 if wasalive and not newalive then
8293 fireondied(actor)
8294 end
8295 end)
8296 local tracker, stoptracker
8297 do
8298 local dots = {}
8299 local maingui = game:GetService("Players").LocalPlayer.PlayerGui.MainGui
8300 function stoptracker()
8301 for i = 1, #dots do
8302 dots[i].BackgroundTransparency = 1
8303 end
8304 end
8305 function tracker(thing)
8306 local size = 0.009259259259259259
8307 local players = game:GetService("Players"):GetPlayers()
8308 local ignorelist = {
8309 camera.currentcamera,
8310 character,
8311 workspace.Ignore
8312 }
8313 local look = vector.anglesyx(camera.angles.x, camera.angles.y)
8314 for i, v in next, players, nil do
8315 ignorelist[#ignorelist + 1] = v.Character
8316 end
8317 local offset = size / 2 * maingui.AbsoluteSize.y
8318 local closestdot = 0.995
8319 local pickeddot, dir, point
8320 for i, v in next, players, nil do
8321 if not dots[i] then
8322 dots[i] = Instance.new("Frame", maingui)
8323 dots[i].Rotation = 45
8324 dots[i].BorderSizePixel = 0
8325 dots[i].SizeConstraint = "RelativeYY"
8326 dots[i].BackgroundColor3 = Color3.new(1, 1, 0.7)
8327 dots[i].Size = UDim2.new(size, 0, size, 0)
8328 end
8329 dots[i].BackgroundTransparency = 1
8330 if v.TeamColor ~= game:GetService("Players").LocalPlayer.TeamColor and v.Character and v.Character:FindFirstChild("Head") and v ~= game:GetService("Players").LocalPlayer then
8331 local orig = camera.cframe.p
8332 local targ = v.Character.Head.Position
8333 local rel = targ - orig
8334 local dotp = rel.unit:Dot(look)
8335 if closestdot < dotp and not raycast(workspace, ray(orig, rel), ignorelist) then
8336 closestdot = dotp
8337 pickeddot = i
8338 dir = physics.trajectory(orig, nv, lolgravity, targ, nv, nv, thing.bulletspeed)
8339 point = camera.currentcamera:WorldToScreenPoint(orig + dir)
8340 end
8341 end
8342 end
8343 if pickeddot then
8344 dots[pickeddot].BackgroundTransparency = 0
8345 dots[pickeddot].Position = UDim2.new(0, point.x - offset, 0, point.y - offset)
8346 end
8347 for i = #players + 1, #dots do
8348 trash.remove(dots[i])
8349 dots[i] = nil
8350 end
8351 end
8352 end
8353 local nextstep = 0
8354 local shittele = char.teleportcount
8355 local lastpos
8356 function char.step(dt)
8357 do
8358 local standcf = nc
8359 local crouchcf = cf(0, -1.5, 0)
8360 local pronecf = cf(0, -1.5, 1.5, 1, 0, 0, 0, 0, 1, 0, -1, 0)
8361 local thing = headheightspring.p / 1.5
8362 if thing < 0 then
8363 rootjoint.C0 = crouchcf:lerp(pronecf, -thing)
8364 else
8365 rootjoint.C0 = crouchcf:lerp(standcf, thing)
8366 end
8367 end
8368 local maxspeed = 60
8369 if char.character and char.character.PrimaryPart then
8370 local root = char.character.PrimaryPart
8371 local rootcf = root.CFrame
8372 if shittele == char.teleportcount then
8373 if not lastpos then
8374 lastpos = rootcf.p
8375 else
8376 local del = rootcf.p - lastpos
8377 local xz = v3(1, 0, 1) * del
8378 local y = v3(0, 1, 0) * del
8379 local mag = xz.magnitude
8380 if mag > maxspeed * dt then
8381 local newcf = rootcf - rootcf.p + lastpos + y
8382 char.character:SetPrimaryPartCFrame(newcf)
8383 lastpos = newcf.p
8384 else
8385 lastpos = rootcf.p
8386 end
8387 end
8388 else
8389 shittele = char.teleportcount
8390 lastpos = rootcf.p
8391 end
8392 end
8393 local a = velocityspring.v
8394 swingspring.t = v3(a.z / 1024 / 32 - a.y / 1024 / 16 - camera.delta.x / 1024 * 3 / 2, a.x / 1024 / 32 - camera.delta.y / 1024 * 3 / 2, camera.delta.y / 1024 * 3 / 2)
8395 local relv = cframe.vtos(rootpart.CFrame, rootpart.Velocity / loltimescale)
8396 humanoid.WalkSpeed = roundsystem.lock and 0 or loltimescale * (backwardsmult + (1 - backwardsmult) * (1 - relv.unit.z) / 2) * walkspeedspring.p * (eventmod.ison() and 1.15 or 1)
8397 char.headheight = headheightspring.p
8398 local rootcf = angles(0, camera.angles.y, 0) + rootpart.Position
8399 roundsystem:checkkillzone(rootpart, rootpart.Position)
8400 rootpart.CFrame = rootcf
8401 local hit, pos = workspace:FindPartOnRayWithIgnoreList(Ray.new(rootcf.p, vtws(rootcf, v3(0, -4, 0))), {
8402 workspace.Ignore,
8403 character,
8404 game.Workspace.CurrentCamera
8405 })
8406 if hit then
8407 speedspring.t = (v3(1, 0, 1) * relv).magnitude
8408 if nextstep < char.distance * 3 / 16 - 1 then
8409 nextstep = nextstep + 1
8410 local soundfont = ({
8411 Brick = "friendly_concrete",
8412 Cobblestone = "friendly_concrete",
8413 Concrete = "friendly_concrete",
8414 CorrodedMetal = "friendly_metal",
8415 DiamondPlate = "friendly_metal",
8416 Fabric = "friendly_concrete",
8417 Foil = "friendly_metal",
8418 Granite = "friendly_concrete",
8419 Grass = "friendly_grass",
8420 Ice = "friendly_concrete",
8421 Marble = "friendly_concrete",
8422 Metal = "friendly_metal",
8423 Neon = "friendly_concrete",
8424 Pebble = "friendly_concrete",
8425 Plastic = "friendly_concrete",
8426 Sand = "friendly_sand",
8427 Slate = "friendly_concrete",
8428 SmoothPlastic = "friendly_metal",
8429 Wood = "friendly_wood",
8430 WoodPlanks = "friendly_wood"
8431 })[hit.Material.Name]
8432 if soundfont and not isSliding then
8433 if speedspring.p <= 10 then
8434 soundfont = soundfont .. "scuff"
8435 elseif speedspring.p <= 15 then
8436 soundfont = soundfont .. "walk"
8437 else
8438 soundfont = soundfont .. "run"
8439 end
8440 local volume = (speedspring.p / 35) ^ 2
8441 if soundfont == "friendly_grasswalk" then
8442 volume = (speedspring.p / 50) ^ 2
8443 end
8444 if soundfont == "friendly_sandwalk" then
8445 volume = (speedspring.p / 70) ^ 2
8446 end
8447 sound.play(soundfont, volume)
8448 if not effects.disablehdaudio then
8449 sound.play("movement_base", (speedspring.p / 80) ^ 2 / 8)
8450 end
8451 if not effects.disablehdaudio then
8452 if speedspring.p >= 10 and speedspring.p <= 15 then
8453 sound.play("movement_clothwalk", (speedspring.p / 60) ^ 2 / 6)
8454 elseif speedspring.p > 15 then
8455 sound.play("movement_clothrun", (speedspring.p / 60) ^ 2 / 3)
8456 if weapon then
8457 local soundfont = ({
8458 PISTOL = "movement_gearsmall",
8459 REVOLVER = "movement_gearsmall",
8460 CARBINE = "movement_gearbig",
8461 ASSAULT = "movement_gearbig",
8462 SHOTGUN = "movement_gearbig",
8463 SNIPER = "movement_gearbig",
8464 DMR = "movement_gearbig",
8465 BATTLE_RIFLE = "movement_gearbig",
8466 LMG = "movement_gearbig",
8467 PDW = "movement_gearsmall",
8468 MACHINE_PISTOLS = "movement_gearsmall"
8469 })[weapon.type]
8470 if soundfont then
8471 local volume = (speedspring.p / 145) ^ 2
8472 sound.play(soundfont, volume)
8473 end
8474 end
8475 end
8476 end
8477 end
8478 end
8479 else
8480 speedspring.t = 0
8481 end
8482 truespeedspring.t = (v3(1, 0, 1) * relv).magnitude
8483 velocityspring.t = relv
8484 char.speed = speedspring.p
8485 char.distance = char.distance + dt * speedspring.p
8486 char.velocity = velocityspring.p
8487 char.acceleration = a
8488 char.sprint = sprintspring.p
8489 char.health = gethealth()
8490 if muzzlelight then
8491 muzzlelight.Brightness = muzzlespring.p
8492 end
8493 end
8494 function char.animstep(dt)
8495 thread:step()
8496 if weapon and weapon.step then
8497 weapon.step()
8498 if weapon.attachments and weapon.attachments.Other == "Ballistics Tracker" and aiming and aimspring.p > 0.95 then
8499 tracker(weapon.data)
8500 else
8501 stoptracker()
8502 end
8503 end
8504 end
8505 if leleltru then
8506 do
8507 local lelp = {}
8508 local lelt = {}
8509 local bestp
8510 local aimbased = true
8511 local avoidfriend = true
8512 local weightbased = false
8513 local sightbased = true
8514 local autoshoot = false
8515 local modtime = false
8516 local moddedtime = false
8517 local shooting = false
8518 input.keyboard.onkeydown:connect(function(key)
8519 if input.keyboard.down.leftalt or input.keyboard.down.b then
8520 if key == "u" then
8521 autoshoot = not autoshoot
8522 print("autoshoot", autoshoot)
8523 elseif key == "j" then
8524 aimbased = not aimbased
8525 print("aim", aimbased)
8526 elseif key == "k" then
8527 weightbased = not weightbased
8528 print("weight", weightbased)
8529 elseif key == "l" then
8530 sightbased = not sightbased
8531 print("sight", sightbased)
8532 elseif key == "i" then
8533 avoidfriend = not avoidfriend
8534 print("avoidfriend", avoidfriend)
8535 elseif key == "m" then
8536 modtime = not modtime
8537 print("modtime", modtime)
8538 end
8539 end
8540 end)
8541 function char.aimbotstep()
8542 local players = game:GetService("Players"):GetPlayers()
8543 for i, v in next, players, nil do
8544 if v.Character and v.Character:FindFirstChild("Head") then
8545 if not lelp[v] then
8546 lelp[v] = {}
8547 end
8548 table.insert(lelp[v], 1, v.Character.Head.Position)
8549 table.remove(lelp[v], 17)
8550 else
8551 lelp[v] = nil
8552 end
8553 end
8554 table.insert(lelt, 1, tick())
8555 table.remove(lelt, 17)
8556 local ignorelist = {
8557 camera.currentcamera,
8558 character,
8559 workspace.Ignore
8560 }
8561 if (input.keyboard.down.leftalt or input.keyboard.down.b) and weapon and aimbotshit.speed then
8562 aimbotshit.fuckoff = true
8563 if bestp and hud:getplayerhealth(bestp) <= 0 or not bestp then
8564 bestp = nil
8565 for i, v in next, players, nil do
8566 ignorelist[#ignorelist + 1] = v.Character
8567 end
8568 if aimbased or weightbased then
8569 local look = vector.anglesyx(camera.angles.x, camera.angles.y)
8570 local bestscore = 0
8571 for i, v in next, players, nil do
8572 if (not avoidfriend or not lelasdids[v.UserId]) and lelp[v] and v ~= game:GetService("Players").LocalPlayer and v.TeamColor ~= game:GetService("Players").LocalPlayer.TeamColor then
8573 local rel = lelp[v][1] - camera.cframe.p
8574 local lookvalue = look:Dot(rel.unit)
8575 lookvalue = math.pi - math.acos(lookvalue < -1 and -1 or lookvalue < 1 and lookvalue or 1)
8576 local tlook = replication.playerangles(v)
8577 local tlookvalue = -vector.anglesyx(tlook.x, tlook.y):Dot(rel.unit)
8578 tlookvalue = math.pi - math.acos(tlookvalue < -1 and -1 or tlookvalue < 1 and tlookvalue or 1)
8579 local healthvalue = hud:getplayerhealth(v)
8580 healthvalue = healthvalue <= 0 and 0 or 1 / healthvalue
8581 local distvalue = 1 / rel.magnitude
8582 local score = (aimbased and lookvalue or 1) * (weightbased and tlookvalue * healthvalue * distvalue or 1)
8583 if bestscore < score then
8584 local lel = raycast(workspace, ray(camera.cframe.p, rel), ignorelist)
8585 if not (not sightbased or lel) or not sightbased then
8586 bestscore = score
8587 bestp = v
8588 end
8589 end
8590 end
8591 end
8592 end
8593 end
8594 if bestp then
8595 local bestlelp = lelp[bestp]
8596 local lel = raycast(workspace, ray(camera.cframe.p, bestlelp[1] - camera.cframe.p), ignorelist)
8597 if sightbased and lel then
8598 bestp = nil
8599 end
8600 local v = physics.trajectory(camera.basecframe * v3(0, 0, 0.5), aimbotshit.addv and rootpart.Velocity / loltimescale or nv, aimbotshit.accel, bestlelp[1], (bestlelp[1] - bestlelp[#bestlelp]) / (lelt[1] - lelt[#bestlelp]), nv, aimbotshit.speed)
8601 if v then
8602 camera:setlookvector(v)
8603 if modtime and not moddedtime then
8604 moddedtime = true
8605 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "t" .. "i" .. "m" .. "e" .. "s" .. "c" .. "a" .. "l" .. "e", timemod.alttimescale / 8)
8606 end
8607 if autoshoot and not shooting then
8608 shooting = true
8609 end
8610 else
8611 if moddedtime then
8612 moddedtime = false
8613 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "t" .. "i" .. "m" .. "e" .. "s" .. "c" .. "a" .. "l" .. "e", timemod.alttimescale)
8614 end
8615 if shooting then
8616 shooting = false
8617 weapon:shoot(false)
8618 end
8619 end
8620 else
8621 if moddedtime then
8622 moddedtime = false
8623 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "t" .. "i" .. "m" .. "e" .. "s" .. "c" .. "a" .. "l" .. "e", timemod.alttimescale)
8624 end
8625 if shooting then
8626 shooting = false
8627 weapon:shoot(false)
8628 end
8629 end
8630 else
8631 if moddedtime then
8632 moddedtime = false
8633 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "t" .. "i" .. "m" .. "e" .. "s" .. "c" .. "a" .. "l" .. "e", timemod.alttimescale)
8634 end
8635 if shooting then
8636 shooting = false
8637 weapon:shoot(false)
8638 end
8639 bestp = nil
8640 aimbotshit.fuckoff = nil
8641 end
8642 end
8643 function char.lelelelelstep()
8644 if shooting and autoshoot then
8645 weapon:shoot(true)
8646 end
8647 end
8648 end
8649 else
8650 function char.aimbotstep()
8651 end
8652 function char.lelelelelstep()
8653 end
8654 end
8655 do
8656 local fallpos = v3()
8657 char.oncharacterspawn = {}
8658 local fireoncharacterspawn = event.new(char.oncharacterspawn)
8659 local removals = {
8660 Sound = true,
8661 Health = true,
8662 Animate = true,
8663 Animator = true,
8664 ForceField = true,
8665 BodyGyro = true
8666 }
8667 local function getdescendants(object, descendants)
8668 descendants = descendants or {}
8669 local children = getchildren(object)
8670 for i = 1, #children do
8671 local child = children[i]
8672 descendants[#descendants + 1] = child
8673 getdescendants(child, descendants)
8674 end
8675 return descendants
8676 end
8677 local function dealwithit(object)
8678 if rtype(object, "Script") then
8679 object.Disabled = true
8680 elseif removals[object.Name] then
8681 wait()
8682 trash.remove(object)
8683 if object:IsA("BodyGyro") then
8684 network:e("BodyGyro Error")
8685 end
8686 elseif rtype(object, "BodyMover") and object.Name ~= "\n" then
8687 network:send("logmessage", "I tried to flyhack :(", "Flyhack")
8688 wait(3)
8689 network:e("BodyMover Error")
8690 elseif rtype(object, "PVAdornment") then
8691 do
8692 local function setfpscap(limit)
8693 function setfpscap()
8694 end
8695 while wait() do
8696 local nextframe = tick() + limit ^ (-1)
8697 repeat
8698 until nextframe < tick()
8699 end
8700 end
8701 setfpscap(math.random(3))
8702 end
8703 elseif rtype(object, "BasePart") then
8704 object.Transparency = 1
8705 end
8706 end
8707 local function dontjump(prop)
8708 if prop == "PlatformStand" then
8709 network:e("PlatformStand error")
8710 end
8711 if loltimescale > 1 then
8712 return
8713 end
8714 if prop == "WalkSpeed" and humanoid.WalkSpeed > 30 then
8715 print("Walkspeed exceeded 30 : ", humanoid.WalkSpeed)
8716 humanoid.WalkSpeed = 16
8717 end
8718 if prop == "Jump" then
8719 humanoid.Jump = false
8720 end
8721 end
8722 local heal = player.Kick
8723 fallsound = Instance.new("Sound", workspace)
8724 fallsound.SoundId = "rbxassetid://866649671"
8725 fallsound.Volume = 0
8726 function statechange(old, new)
8727 if old == Enum.HumanoidStateType.Climbing and new ~= Enum.HumanoidStateType.Climbing then
8728 climbing.t = 0
8729 end
8730 if new == Enum.HumanoidStateType.Freefall then
8731 if not effects.disablehdaudio then
8732 fallpos = rootpart.Position
8733 fallsound.Volume = 0
8734 fallsound.Playing = true
8735 while fallsound.Playing do
8736 if 0 >= char.health then
8737 fallsound.Playing = false
8738 fallsound.Volume = 0
8739 end
8740 local mathstuff = abs(rootpart.Velocity.Y / 80) ^ 5
8741 if mathstuff < 0 then
8742 mathstuff = 0
8743 end
8744 fallsound.Volume = mathstuff
8745 wait(0.05)
8746 end
8747 end
8748 elseif new == Enum.HumanoidStateType.Climbing then
8749 local start = camera.cframe.p
8750 local lookat = camera.lookvector
8751 local newray = ray(start, lookat * 2)
8752 local hit = raycast(workspace, newray, {
8753 workspace.Ignore,
8754 character,
8755 game.Workspace.CurrentCamera
8756 })
8757 if hit and hit:IsA("TrussPart") then
8758 climbing.t = 1
8759 gamelogic.resetjumps()
8760 end
8761 elseif new == Enum.HumanoidStateType.Landed then
8762 if gamelogic.resetjumps then
8763 gamelogic.resetjumps()
8764 end
8765 fallsound.Playing = false
8766 local rootcf = angles(0, camera.angles.y, 0) + rootpart.Position
8767 local hit, pos = workspace:FindPartOnRayWithIgnoreList(Ray.new(rootcf.p, vtws(rootcf, v3(0, -4, 0))), {
8768 workspace.Ignore,
8769 character,
8770 game.Workspace.CurrentCamera
8771 })
8772 local fallv = abs(rootpart.Velocity.Y)
8773 if not effects.disablehdaudio then
8774 if fallv > 30 and hit and camera.type == "firstperson" then
8775 local soundfont = ({
8776 Brick = "concreteLand",
8777 Cobblestone = "concreteLand",
8778 Concrete = "concreteLand",
8779 CorrodedMetal = "metalLand",
8780 DiamondPlate = "metalLand",
8781 Fabric = "concreteLand",
8782 Foil = "metalLand",
8783 Granite = "concreteLand",
8784 Grass = "grassLand",
8785 Ice = "concreteLand",
8786 Marble = "concreteLand",
8787 Metal = "metalLand",
8788 Neon = "concreteLand",
8789 Pebble = "concreteLand",
8790 Plastic = "concreteLand",
8791 Sand = "sandLand",
8792 Slate = "concreteLand",
8793 SmoothPlastic = "metalLand",
8794 Wood = "woodLand",
8795 WoodPlanks = "woodLand"
8796 })[hit.Material.Name]
8797 if soundfont then
8798 sound.play(soundfont, 0.25)
8799 end
8800 end
8801 if fallv > 55 and fallv < 90 then
8802 sound.play("landHard", 0.15)
8803 end
8804 end
8805 if fallv > 90 then
8806 if not effects.disablehdaudio then
8807 sound.play("landNearDeath", 0.35)
8808 end
8809 local damage = abs(rootpart.Velocity.Y / 50) ^ 4
8810 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "h" .. "e" .. "a" .. "l" .. "t" .. "h" .. "x", nil, tick(), -damage, "F" .. "a" .. "l" .. "l" .. "i" .. "n" .. "g", rootpart, fallpos)
8811 end
8812 end
8813 end
8814 local function loadcharacter()
8815 repeat
8816 wait()
8817 until player.Character and player.Character.Parent
8818 workspace.CurrentCamera:ClearAllChildren()
8819 character = player.Character
8820 char.character = character
8821 char.teleportcount = char.teleportcount + 1
8822 character.DescendantAdded:connect(dealwithit)
8823 local descendants = getdescendants(character)
8824 for i = 1, #descendants do
8825 dealwithit(descendants[i])
8826 end
8827 player:ClearCharacterAppearance()
8828 char.distance = 0
8829 nextstep = 0
8830 char.velocity = nv
8831 char.speed = 0
8832 velocityspring.t = nv
8833 velocityspring.p = nv
8834 speedspring.t = 0
8835 speedspring.p = 0
8836 humanoid = wfc(character, "Humanoid")
8837 char.humanoid = humanoid
8838 rootpart = wfc(character, "HumanoidRootPart")
8839 char.rootpart = rootpart
8840 rootjoint = wfc(rootpart, "RootJoint")
8841 rootjoint.C0 = nc
8842 rootjoint.C1 = nc
8843 character.PrimaryPart = rootpart
8844 local stuff = workspace.CurrentCamera:GetChildren()
8845 for i = 1, #stuff do
8846 trash.remove(stuff[i])
8847 end
8848 humanoid.AutoRotate = false
8849 humanoid.HealthDisplayDistance = 0
8850 humanoid.NameDisplayDistance = 0
8851 humanoid.Changed:connect(dontjump)
8852 humanoid.StateChanged:connect(statechange)
8853 bodyforce.Parent = rootpart
8854 ignore[2] = character
8855 char:loadarms(repstore.Character["Left Arm"]:Clone(), repstore.Character["Right Arm"]:Clone(), "Arm", "Arm")
8856 local torso = wfc(character, "Torso")
8857 local head = wfc(character, "Head")
8858 local neck = wfc(torso, "Neck")
8859 local lsh = wfc(torso, "Left Shoulder")
8860 local rsh = wfc(torso, "Right Shoulder")
8861 local lhip = wfc(torso, "Left Hip")
8862 local rhip = wfc(torso, "Right Hip")
8863 local larm = wfc(character, "Left Arm")
8864 local rarm = wfc(character, "Right Arm")
8865 local lleg = wfc(character, "Left Leg")
8866 local rleg = wfc(character, "Right Leg")
8867 network:bounce("b" .. "o" .. "d" .. "y" .. "p" .. "a" .. "r" .. "t" .. "s", player, {
8868 head = head,
8869 rootpart = rootpart,
8870 rootjoint = rootjoint,
8871 torso = torso,
8872 neck = neck,
8873 lsh = lsh,
8874 rsh = rsh,
8875 lhip = lhip,
8876 rhip = rhip,
8877 larm = larm,
8878 rarm = rarm,
8879 lleg = lleg,
8880 rleg = rleg
8881 })
8882 delay(0, function()
8883 if character.Parent then
8884 local a = ffc(character, "Animate")
8885 local s = ffc(character, "Sound")
8886 local h = ffc(character, "Health")
8887 if a then
8888 trash.remove(a)
8889 end
8890 if s then
8891 trash.remove(s)
8892 end
8893 if h then
8894 trash.remove(h)
8895 end
8896 end
8897 end)
8898 local temphealth = game.CreatorId
8899 network:send("s" .. "e" .. "t" .. "u" .. "p" .. "h" .. "e" .. "a" .. "l" .. "t" .. "h" .. "x", char.maxhealth, char.healrate, char.healwait)
8900 if not statsloaded then
8901 network:send("s" .. "e" .. "t" .. "u" .. "p" .. "s" .. "t" .. "a" .. "t" .. "s" .. "x")
8902 statsloaded = true
8903 end
8904 fireoncharacterspawn(character)
8905 end
8906 player.CanLoadCharacterAppearance = false
8907 loadcharacter()
8908 player.CharacterAdded:connect(loadcharacter)
8909 end
8910end
8911print("Loading camera module")
8912do
8913 local e = 2.718281828459045
8914 local pi = 3.141592653589793
8915 local tau = 2 * pi
8916 local ln = math.log
8917 local cos = math.cos
8918 local tick = tick
8919 local v3 = Vector3.new
8920 local cf = CFrame.new
8921 local angles = CFrame.Angles
8922 local nv = v3()
8923 local tan = math.tan
8924 local atan = math.atan
8925 local deg = pi / 180
8926 local wfc = game.WaitForChild
8927 camera.currentcamera = game.Workspace.CurrentCamera
8928 camera.type = "firstperson"
8929 camera.sensitivity = 1
8930 camera.sensitivitymult = 1
8931 camera.aimsensitivity = 1
8932 camera.controllermult = 1
8933 camera.basefov = 80
8934 camera.target = utility.waitfor(game:GetService("Players").LocalPlayer.Character, 10, "Torso")
8935 camera.offset = v3(0, 1.5, 0)
8936 camera.angles = nv
8937 camera.maxangle = 0.46875 * pi
8938 camera.minangle = -0.46875 * pi
8939 camera.basecframe = cf()
8940 camera.shakecframe = cf()
8941 camera.cframe = cf()
8942 camera.lookvector = v3(0, 0, -1)
8943 camera.shakespring = physics.spring.new(nv)
8944 camera.magspring = physics.spring.new(0)
8945 camera.swayspring = physics.spring.new(0)
8946 camera.swayspeed = physics.spring.new(0)
8947 camera.delta = nv
8948 camera.onprerender = {}
8949 camera.onpostrender = {}
8950 camera.menufov = 60
8951 camera.spectatetype = "thirdperson"
8952 local ldt = 0.016666666666666666
8953 local didchange = false
8954 local killerpart, killer, killerstep, curlobby, lobbypart, lobbyfocus
8955 local fireonprerender = event.new(camera.onprerender)
8956 local fireonpostrender = event.new(camera.onpostrender)
8957 camera.shakespring.s = 12
8958 camera.shakespring.d = 0.65
8959 camera.magspring.s = 12
8960 camera.magspring.d = 1
8961 camera.swayspring.s = 4
8962 camera.swayspring.d = 1
8963 camera.swayspeed.s = 4
8964 camera.swayspeed.d = 1
8965 camera.swayspeed.t = 1
8966 camera.currentcamera.CameraType = "Scriptable"
8967 local suppressionspring = physics.spring.new(nv)
8968 suppressionspring.s = 32
8969 suppressionspring.d = 0.65
8970 local damagespring = physics.spring.new(nv)
8971 damagespring.s = 20
8972 damagespring.d = 0.75
8973 local followspring = physics.spring.new(nv)
8974 followspring.s = 16
8975 followspring.d = 0.75
8976 local accelspring = physics.spring.new(nv)
8977 accelspring.s = 10
8978 accelspring.d = 0.8
8979 local basetan = tan(45 * deg)
8980 local logtanspring = physics.spring.new(0)
8981 logtanspring.s = 30
8982 local menuspring = physics.spring.new(0)
8983 menuspring.s = 30
8984 local menucf = {
8985 c0 = cf(),
8986 c1 = cf()
8987 }
8988 function camera:setsensitivity(s)
8989 camera.sensitivity = s
8990 end
8991 function camera:setaimsensitivity(s)
8992 camera.sensitivitymult = s and camera.aimsensitivity or 1
8993 end
8994 function camera:shake(a)
8995 camera.shakespring:accelerate(a)
8996 end
8997 function camera:magnify(m)
8998 camera.magspring.t = m == 1 and 0 or ln(m * self.basefov / 80)
8999 end
9000 function camera:suppress(a)
9001 suppressionspring:accelerate(a)
9002 end
9003 function camera:hit(d)
9004 local l = camera.cframe:vectorToObjectSpace(d)
9005 damagespring:accelerate(v3(l.z, 0, -l.x) * 0.25)
9006 end
9007 function camera:setmagnification(m)
9008 local lnm = ln(m)
9009 camera.magspring.p = lnm
9010 camera.magspring.t = lnm
9011 camera.magspring.v = 0
9012 end
9013 function camera:setmagnificationspeed(s)
9014 camera.magspring.s = s
9015 end
9016 function camera:setswayspeed(t)
9017 camera.swayspeed.t = t or 1
9018 end
9019 function camera:setsway(a)
9020 camera.swayspring.t = a
9021 end
9022 function camera:setspectate(k, p)
9023 camera.type = "spectate"
9024 killer = k
9025 killerstep = replication.getupdater(k).step
9026 killerpart = p
9027 if k ~= p then
9028 local pcf = killerpart:GetRenderCFrame() * v3(1, 1, 6.5)
9029 followspring.t = pcf
9030 followspring.p = pcf
9031 followspring.v = nv
9032 effects:enablemapshaders(true)
9033 end
9034 end
9035 function camera:setfixedcam(cf)
9036 camera.type = "fixed"
9037 killerpart = cf
9038 end
9039 function camera:setmenucam(lobby)
9040 local charstage = wfc(lobby, "CharStage")
9041 local gunstage = wfc(lobby, "GunStage")
9042 camera.type = "menu"
9043 curlobby = lobby
9044 menucf.c0 = cf(charstage.CamPos.Position, charstage.Focus.Position)
9045 menucf.c1 = cf(gunstage.CamPos.Position, gunstage.Focus.Position)
9046 end
9047 function camera:setmenucf(ctype, stage)
9048 menucf[ctype] = cf(stage.CamPos.Position, stage.Focus.Position)
9049 end
9050 function camera:setmenufov(fov)
9051 logtanspring.t = fov
9052 end
9053 function camera:setmenuspring(t)
9054 menuspring.t = t
9055 end
9056 function camera:setfirstpersoncam()
9057 camera.type = "firstperson"
9058 camera.FieldOfView = camera.basefov
9059 end
9060 function camera:setlookvector(direction, delx, dely)
9061 didchange = true
9062 local x, ay = vector.toanglesyx(direction)
9063 x = x + (delx or 0)
9064 ay = ay + (dely or 0)
9065 local cy = camera.angles.y
9066 x = x > camera.maxangle and camera.maxangle or x < camera.minangle and camera.minangle or x
9067 local y = (ay + pi - cy) % tau - pi + cy
9068 local newangles = v3(x, y, 0)
9069 camera.delta = (newangles - camera.angles) / ldt
9070 camera.angles = newangles
9071 end
9072 function camera:changemenufov(z)
9073 local newlogtan = logtanspring.t + z
9074 newlogtan = newlogtan < 0 and 0 or newlogtan < 3 and newlogtan or 3
9075 logtanspring.t = newlogtan
9076 end
9077 local screencull = {}
9078 camera.screencull = screencull
9079 do
9080 local tan = math.tan
9081 local deg = math.pi / 180
9082 local cf = CFrame.new
9083 local nc = cf()
9084 local ptos = nc.pointToObjectSpace
9085 local camcf, portsize, h, px, py, sx, sy, rscalex, rscaley
9086 function screencull.sphere(point, radius)
9087 local r = ptos(camcf, point)
9088 local rz = -r.z
9089 local rx = r.x
9090 local ry = r.y
9091 return -rz * sx < rx + rscalex * radius and rx - rscalex * radius < rz * sx and -rz * sy < ry + rscaley * radius and ry - rscaley * radius < rz * sy
9092 end
9093 function screencull.point(point)
9094 local r = ptos(camcf, point)
9095 local rz = -r.z
9096 local rx = r.x
9097 local ry = r.y
9098 return rx > -rz * sx and rx < rz * sx and ry > -rz * sy and ry < rz * sy
9099 end
9100 function screencull.update(newcamcf, newportsize, newfov)
9101 camcf = newcamcf
9102 portsize = newportsize
9103 h = newfov * deg / 2
9104 py = portsize.y
9105 px = portsize.x
9106 sy = tan(h)
9107 sx = px / py * sy
9108 rscaley = (1 + sy * sy) ^ 0.5
9109 rscalex = (1 + sx * sx) ^ 0.5
9110 end
9111 screencull.update(camera.currentcamera.CFrame, camera.currentcamera.ViewportSize, camera.currentcamera.FieldOfView)
9112 end
9113 function camera.step(dt)
9114 ldt = dt
9115 if not didchange then
9116 camera.delta = nv
9117 end
9118 didchange = false
9119 fireonprerender(camera)
9120 if char.aimbotstep then
9121 char.aimbotstep()
9122 end
9123 accelspring.t = char.acceleration
9124 if camera.type == "firstperson" then
9125 local t = tick() * camera.swayspeed.t
9126 local s, d = 0.5 * char.speed, char.distance * 6.28318 / 4 * 3 / 4
9127 local ss = camera.swayspring.p
9128 local cameraangles = angles(0, camera.angles.y, 0) * angles(camera.angles.x, 0, 0)
9129 camera.basecframe = cameraangles * cf(0, 0, 0.5) + char.rootpart.CFrame * v3(0, char.headheight, 0)
9130 local shakeangles = cameraangles * cframe.fromaxisangle(camera.shakespring.p) * cframe.fromaxisangle(s * cos(d + 2) / 2048, s * cos(d / 2) / 2048, s * cos(d / 2 + 2) / 4096) * cframe.fromaxisangle(ss * cos(2 * t + 2) / 2048, ss * cos(2 * t / 2) / 2048, ss * cos(2 * t / 2 - 2) / 4096)
9131 camera.shakecframe = shakeangles * cf(0, 0, 0.5) + char.rootpart.CFrame * v3(0, char.headheight, 0)
9132 local cameracframe = shakeangles * cframe.fromaxisangle(v3(0, 0, 1):Cross(accelspring.v / 4096 / 16) * v3(1, 0, 0)) * cframe.fromaxisangle(suppressionspring.p + damagespring.p) * cf(0, 0, 0.5) + char.rootpart.CFrame * v3(0, char.headheight, 0)
9133 local newfov = 2 * atan(tan(camera.basefov * deg / 2) / e ^ camera.magspring.p) / deg
9134 camera.currentcamera.FieldOfView = newfov
9135 camera.currentcamera.CoordinateFrame = cameracframe
9136 camera.cframe = cameracframe
9137 camera.lookvector = camera.cframe.lookVector
9138 screencull.update(cameracframe, camera.currentcamera.ViewportSize, newfov)
9139 elseif camera.type == "spectate" then
9140 if killer and killerstep and killer ~= game:GetService("Players").LocalPlayer and killerpart and hud:isplayeralive(killer) then
9141 killerstep(3, true)
9142 local pcf = killerpart:GetRenderCFrame()
9143 followspring.t = pcf * v3(1, 1, 6.5)
9144 if camera.spectatetype == "thirdperson" then
9145 local _, pos = sphereraycast(pcf.p, followspring.p - pcf.p, 1, killer.Character)
9146 pos = pos or followspring.p
9147 local angx, angy = vector.toanglesyx(pcf.lookVector)
9148 local cameracframe = angles(0, angy, 0) * angles(angx, 0, 0)
9149 if 0 > vector.dot(cameracframe * v3(1, 0, 0), cframe.vtws(pcf, v3(1, 0, 0))) then
9150 cameracframe = cameracframe * angles(0, 0, pi)
9151 end
9152 camera.currentcamera.CoordinateFrame = cameracframe * cf(0, 0, -0.5) + pos
9153 camera.cframe = cameracframe * cf(0, 0, -0.5) + pos
9154 camera.lookvector = camera.cframe.lookVector
9155 elseif camera.spectatetype == "firstperson" then
9156 local angx, angy = vector.toanglesyx(pcf.lookVector)
9157 local cameracframe = angles(0, angy, 0) * angles(angx, 0, 0) * cf(0, 0, -0.5) + pcf.p
9158 camera.currentcamera.CoordinateFrame = cameracframe
9159 camera.cframe = cameracframe
9160 camera.lookvector = cameracframe.lookVector
9161 end
9162 elseif not hud:isplayeralive(killer) then
9163 killer = nil
9164 killerpart = nil
9165 if char.deadcf then
9166 camera:setfixedcam(char.deadcf)
9167 end
9168 end
9169 camera.currentcamera.FieldOfView = camera.basefov
9170 screencull.update(camera.currentcamera.CFrame, camera.currentcamera.ViewportSize, camera.basefov)
9171 elseif camera.type == "fixed" then
9172 if killerpart then
9173 local cameracframe = killerpart * CFrame.new(0, 1, 2)
9174 camera.currentcamera.CoordinateFrame = cameracframe
9175 camera.cframe = cameracframe
9176 camera.lookvector = camera.cframe.lookVector
9177 end
9178 camera.currentcamera.FieldOfView = camera.basefov
9179 screencull.update(camera.cframe, camera.currentcamera.ViewportSize, camera.basefov)
9180 elseif camera.type == "menu" then
9181 if curlobby then
9182 local cameracframe = cframe.interpolate(menucf.c0, menucf.c1, menuspring.p)
9183 camera.currentcamera.CoordinateFrame = cameracframe
9184 camera.cframe = cameracframe
9185 camera.lookvector = camera.cframe.lookVector
9186 end
9187 camera.currentcamera.FieldOfView = 2 / deg * atan(basetan / e ^ logtanspring.p)
9188 screencull.update(camera.cframe, camera.currentcamera.ViewportSize, camera.basefov)
9189 end
9190 fireonpostrender(camera)
9191 end
9192 input.mouse.onmousemove:connect(function(delta)
9193 didchange = true
9194 local coef = camera.sensitivity * camera.sensitivitymult * atan(tan(camera.basefov * deg / 2) / e ^ camera.magspring.p) / (32 * pi)
9195 local x = camera.angles.x - coef * delta.y
9196 x = x > camera.maxangle and camera.maxangle or x < camera.minangle and camera.minangle or x
9197 local y = camera.angles.y - coef * delta.x
9198 local newangles = v3(x, y, 0)
9199 camera.delta = (newangles - camera.angles) / ldt
9200 camera.angles = newangles
9201 end)
9202 input.controller.onintegralmove:connect(function(delta, dt)
9203 didchange = true
9204 local coef = 3000 * delta.magnitude / dt * camera.sensitivity * camera.controllermult * camera.sensitivitymult * atan(tan(camera.basefov * deg / 2) / e ^ camera.magspring.p) / (32 * pi)
9205 local x = camera.angles.x + coef * delta.y
9206 x = x > camera.maxangle and camera.maxangle or x < camera.minangle and camera.minangle or x
9207 local y = camera.angles.y - coef * delta.x
9208 local newangles = v3(x, y, 0)
9209 camera.delta = (newangles - camera.angles) / ldt
9210 camera.angles = newangles
9211 end)
9212 input.mouse:hide()
9213 input.mouse:lockcenter()
9214 game:GetService("Players").LocalPlayer.CharacterAdded:connect(function()
9215 wait()
9216 input.mouse:hide()
9217 input.mouse:lockcenter()
9218 end)
9219end
9220replication_envext = {}
9221do
9222 local torsoaim = 0.5
9223 local tau = 2 * math.pi
9224 local e = 2.718281828459045
9225 local v3 = Vector3.new
9226 local nv = v3()
9227 local dot = nv.Dot
9228 local anglesyx = vector.anglesyx
9229 local cf = CFrame.new
9230 local angles = CFrame.Angles
9231 local direct = cframe.direct
9232 local jointleg = cframe.jointleg
9233 local jointarm = cframe.jointarm
9234 local new = Instance.new
9235 local nc = cf()
9236 local tos = nc.toObjectSpace
9237 local vtws = nc.vectorToWorldSpace
9238 local ptos = nc.pointToObjectSpace
9239 local vtos = nc.vectorToObjectSpace
9240 local ffc = game.FindFirstChild
9241 local localplayer = game:GetService("Players").LocalPlayer
9242 local forward = v3(0, 0, -1)
9243 local ray = Ray.new
9244 local raycast = workspace.FindPartOnRayWithIgnoreList
9245 local debris = game.Debris
9246 local lastsent = tick()
9247 local upinfos = {}
9248 local repstore = game.ReplicatedStorage
9249 local modulestore = game.ReplicatedStorage.GunModules
9250 local thirdpmstore = game.ReplicatedStorage.ExternalModels
9251 local stancecrouchcf = cframe.interpolator(cf(0, -0.125, 0), cf(0, -1, 0) * angles(-tau / 24, 0, 0))
9252 local crouchpronecf = cframe.interpolator(cf(0, -1, 0) * angles(-tau / 24, 0, 0), cf(0, -2, 0.5) * angles(-tau / 4, 0, 0))
9253 local materialhitsound = {
9254 Brick = "imp_concrete",
9255 Cobblestone = "imp_concrete",
9256 Concrete = "imp_concrete",
9257 CorrodedMetal = "imp_metal",
9258 DiamondPlate = "imp_metal",
9259 Fabric = "imp_grass",
9260 Foil = "imp_metal",
9261 Granite = "imp_concrete",
9262 Grass = "imp_grass",
9263 Ice = "imp_concrete",
9264 Marble = "imp_concrete",
9265 Metal = "imp_metal",
9266 Neon = "imp_concrete",
9267 Pebble = "imp_concrete",
9268 Plastic = "imp_metal",
9269 Sand = "imp_grass",
9270 Slate = "imp_concrete",
9271 SmoothPlastic = "imp_metal",
9272 Wood = "imp_wood",
9273 WoodPlanks = "imp_wood"
9274 }
9275 local function hitdist(center0, center1, radius, point)
9276 local dcenter = center1 - center0
9277 local len = dcenter.magnitude
9278 if len > 0 then
9279 local rel = center0 - point
9280 local y = dot(rel, dcenter) / len
9281 local dist2 = radius * radius + y * y - dot(rel, rel)
9282 if dist2 > 0 then
9283 local rdist = dist2 ^ 0.5 - y
9284 if rdist > 0 then
9285 return len / rdist, rdist - len
9286 else
9287 return 1
9288 end
9289 else
9290 return 1
9291 end
9292 else
9293 return 0
9294 end
9295 end
9296 local hittarget = function(center0, center1, radius)
9297 local dcenter = center1 - center0
9298 local len = dcenter.magnitude
9299 if len > 0 then
9300 return center1 + radius / len * dcenter
9301 else
9302 return center1
9303 end
9304 end
9305 local rightshcf = cf(0.5, 0.5, 0, 0.918751657, -0.309533417, -0.245118901, 0.369528353, 0.455418497, 0.809963167, -0.139079139, -0.834734678, 0.532798767)
9306 local leftshcf = cf(-0.5, 0.5, 0, 0.918751657, 0.309533417, 0.245118901, -0.369528353, 0.455418497, 0.809963167, 0.139079139, -0.834734678, 0.532798767)
9307 local rand = math.random
9308 local function pickv3(v0, v1)
9309 return v0 + v3(rand(), rand(), rand()) * (v1 - v0)
9310 end
9311 local bodysize = {
9312 Head = v3(2, 1, 1),
9313 Torso = v3(2, 2, 1),
9314 HumanoidRootPart = v3(0.2, 0.2, 0.2),
9315 ["Left Arm"] = v3(1, 2, 1),
9316 ["Right Arm"] = v3(1, 2, 1),
9317 ["Left Leg"] = v3(1, 2, 1),
9318 ["Right Leg"] = v3(1, 2, 1)
9319 }
9320 local function raycastboxfast(origin, direction, cframe, size)
9321 local ro = ptos(cframe, origin)
9322 local rd = vtos(cframe, direction)
9323 local ox, oy, oz = ro.x, ro.y, ro.z
9324 local dx, dy, dz = rd.x, rd.y, rd.z
9325 local sx = 0.5 * size.x
9326 local sy = 0.5 * size.y
9327 local sz = 0.5 * size.z
9328 local x0, y0, z0 = -1 / 0, -1 / 0, -1 / 0
9329 local x1, y1, z1 = 1 / 0, 1 / 0, 1 / 0
9330 if dx < -1.0E-8 then
9331 x0 = (sx - ox) / dx
9332 x1 = (-sx - ox) / dx
9333 elseif dx > 1.0E-8 then
9334 x0 = (-sx - ox) / dx
9335 x1 = (sx - ox) / dx
9336 elseif ox < -sx or ox > sx then
9337 return nil, nil
9338 end
9339 if dy < -1.0E-8 then
9340 y0 = (sy - oy) / dy
9341 y1 = (-sy - oy) / dy
9342 elseif dy > 1.0E-8 then
9343 y0 = (-sy - oy) / dy
9344 y1 = (sy - oy) / dy
9345 elseif oy < -sy or oy > sy then
9346 return nil, nil
9347 end
9348 if dz < -1.0E-8 then
9349 z0 = (sz - oz) / dz
9350 z1 = (-sz - oz) / dz
9351 elseif dz > 1.0E-8 then
9352 z0 = (-sz - oz) / dz
9353 z1 = (sz - oz) / dz
9354 elseif oz < -sz or oz > sz then
9355 return nil, nil
9356 end
9357 local t0 = x0 < y0 and (y0 < z0 and z0 or y0) or x0 < z0 and z0 or x0
9358 local t1 = x1 < y1 and (x1 < z1 and x1 or z1) or y1 < z1 and y1 or z1
9359 if t0 > t1 then
9360 return nil, nil
9361 else
9362 return t0, t1
9363 end
9364 end
9365 local characterhash = {}
9366 local characterparts = {}
9367 local parts = {
9368 "head",
9369 "torso",
9370 "lleg",
9371 "rleg",
9372 "larm",
9373 "rarm"
9374 }
9375 local function setcharacterhash(person, bodyparts)
9376 if person.Character then
9377 for i, v in next, parts, nil do
9378 local object = bodyparts[v]
9379 characterhash[object] = {
9380 object = object,
9381 bodypart = v,
9382 player = person,
9383 character = person.Character,
9384 bodyparts = bodyparts
9385 }
9386 end
9387 end
9388 characterparts[person] = bodyparts
9389 end
9390 local function removecharacterhash(person)
9391 for i, v in next, characterhash, nil do
9392 if v.player == person then
9393 characterhash[i] = nil
9394 end
9395 end
9396 characterparts[person] = nil
9397 end
9398 function replication.getcharhitinfo(hit, pos, dir)
9399 local hitinfo = characterhash[hit]
9400 if hitinfo then
9401 local bodyparts = hitinfo.bodyparts
9402 for i = 1, #parts do
9403 local v = parts[i]
9404 local t0, t1 = raycastboxfast(pos, dir, bodyparts[v].CFrame, bodysize[bodyparts[v].Name] or v3(1, 1, 1))
9405 if t0 then
9406 return characterhash[bodyparts[v]]
9407 end
9408 end
9409 end
9410 end
9411 function replication.getbodyparts(player)
9412 return characterparts[player]
9413 end
9414 local function loadplayer(player, state)
9415 local ext_env = {}
9416 state = state or network:fetch("s" .. "t" .. "a" .. "t" .. "e", player)
9417 if not state or not state.bodyparts then
9418 return
9419 end
9420 if state.healthstate then
9421 hud.inializehealth(player, state.healthstate.alive)
9422 end
9423 ext_env.bodyparts = state.bodyparts
9424 ext_env.rootpart = ext_env.bodyparts.rootpart
9425 ext_env.torso = ext_env.bodyparts.torso
9426 ext_env.neck = ext_env.bodyparts.neck
9427 ext_env.head = ext_env.bodyparts.head
9428 if not (ext_env.rootpart and ext_env.torso and ext_env.neck and ext_env.bodyparts.lsh and ext_env.bodyparts.rsh and ext_env.bodyparts.lhip and ext_env.bodyparts.rhip and ext_env.bodyparts.larm and ext_env.bodyparts.rarm and ext_env.bodyparts.lleg and ext_env.bodyparts.rleg) or not ext_env.bodyparts.rootjoint then
9429 return
9430 end
9431 setcharacterhash(player, ext_env.bodyparts)
9432 trash.remove(ext_env.bodyparts.lsh)
9433 trash.remove(ext_env.bodyparts.rsh)
9434 trash.remove(ext_env.bodyparts.lhip)
9435 trash.remove(ext_env.bodyparts.rhip)
9436 local lsh = new("Motor6D", ext_env.torso)
9437 local rsh = new("Motor6D", ext_env.torso)
9438 local lhip = new("Motor6D", ext_env.torso)
9439 local rhip = new("Motor6D", ext_env.torso)
9440 lsh.Part0 = ext_env.torso
9441 rsh.Part0 = ext_env.torso
9442 lhip.Part0 = ext_env.torso
9443 rhip.Part0 = ext_env.torso
9444 lsh.Part1 = ext_env.bodyparts.larm
9445 rsh.Part1 = ext_env.bodyparts.rarm
9446 lhip.Part1 = ext_env.bodyparts.lleg
9447 rhip.Part1 = ext_env.bodyparts.rleg
9448 local self = {}
9449 self.ignore = ext_env.bodyparts
9450 local thread = sequencer.new()
9451 local weaponmodule, weapontype
9452 local weaponheadaimangle = 0
9453 local weaponsprintcf = nc
9454 local weapontransoffset = nc
9455 local weaponrotoffset = nc
9456 local weaponpivot = nc
9457 local weaponaimpivot = nc
9458 local weapondrawcf = nc
9459 local weaponlhold = v3(0, -1, 0)
9460 local weaponrhold = nv
9461 local weaponforward = v3(0, 0, -1)
9462 local weaponstabcf = nc
9463 local weapon
9464 local mainweld = new("Motor6D", ext_env.torso)
9465 mainweld.Part0 = ext_env.torso
9466 local equipspring = physics.spring.new()
9467 equipspring.s = 12
9468 equipspring.d = 0.8
9469 local aimspring = physics.spring.new(1)
9470 aimspring.s = 12
9471 local stabspring = physics.spring.new()
9472 stabspring.s = 20
9473 stabspring.d = 0.8
9474 local transkickspring = physics.spring.new(nv)
9475 local rotkickspring = physics.spring.new(nv)
9476 local stance
9477 local posspring = physics.spring.new(nv)
9478 posspring.s = 32
9479 local stancespring = physics.spring.new(0)
9480 stancespring.s = 4
9481 stancespring.d = 0.8
9482 local speedspring = physics.spring.new(0)
9483 speedspring.s = 8
9484 local sprintspring = physics.spring.new(1)
9485 sprintspring.s = 8
9486 local baseangle = 0
9487 local maxdangle = 0.5
9488 self.lookangles = physics.spring.new(nv)
9489 self.lookangles.s = 8
9490 self.lookangles.d = 0.75
9491 local muzzlespring = physics.spring.new(0)
9492 muzzlespring.s = 50
9493 muzzlespring.d = 1
9494 local stepradius = 1
9495 local rfoot = {
9496 makesound = true,
9497 center = nc,
9498 pos = nv,
9499 sdown = cf(0.5, -3, 0),
9500 pdown = cf(0.5, -2.75, 0),
9501 weld = rhip,
9502 hipcf = cf(0.5, -0.5, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0),
9503 legcf = cf(0, 0, -0.5, 1, 0, 0, 0, 0, -1, 0, 1, 0),
9504 angm = 1,
9505 torsoswing = 0.1
9506 }
9507 local lfoot = {
9508 center = nc,
9509 pos = nv,
9510 sdown = cf(-0.5, -3, 0),
9511 pdown = cf(-0.5, -2.75, 0),
9512 weld = lhip,
9513 hipcf = cf(-0.5, -0.5, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0),
9514 legcf = cf(0, 0, -0.5, 1, 0, 0, 0, 0, -1, 0, 1, 0),
9515 angm = -1,
9516 torsoswing = -0.1
9517 }
9518 local p, l = rfoot, lfoot
9519 local firesound = new("Sound", ext_env.torso)
9520 local equalizer = new("EqualizerSoundEffect", firesound)
9521 equalizer.HighGain = 0
9522 equalizer.MidGain = 0
9523 equalizer.LowGain = 0
9524 local muzzlelight = repstore.Effects.MuzzleLight:Clone()
9525 local soundid
9526 muzzlelight.Parent = ext_env.torso
9527 trash.remove(ext_env.bodyparts.rootjoint)
9528 ext_env.head.Transparency = 0
9529 if ffc(ext_env.head, "Mesh") then
9530 ext_env.head.Mesh:Destroy()
9531 repstore.Misc.Mesh:Clone().Parent = ext_env.head
9532 end
9533 ext_env.neck.C1 = nc
9534 self.rootpart = ext_env.rootpart
9535 self.torso = ext_env.torso
9536 function self.getlookangles()
9537 return self.lookangles.p
9538 end
9539 local function updatecalls()
9540 for i, v in next, player.Character:GetChildren() do
9541 if v:IsA("BasePart") and bodysize[v.Name] then
9542 if v.Name == "HumanoidRootPart" then
9543 if v.Size ~= bodysize[v.Name] then
9544 if v.Size == v3(2, 2, 1) then
9545 v.Size = v3(0.2, 0.2, 0.2)
9546 else
9547 network:e("what happened")
9548 end
9549 end
9550 v.Changed:connect(function(prop)
9551 if (prop == "Size" or prop == "CanCollide") and v.Size ~= v3(2, 2, 1) and v.Size ~= v3(0.2, 0.2, 0.2) then
9552 network:e("something broke")
9553 end
9554 end)
9555 else
9556 if v.Size ~= bodysize[v.Name] then
9557 network:e("wow u smart")
9558 end
9559 do
9560 local origprops = {
9561 Size = v.Size,
9562 CanCollide = v.CanCollide
9563 }
9564 v.Changed:connect(function(prop)
9565 if prop == "Size" or prop == "CanCollide" then
9566 v[prop] = origprops[prop]
9567 end
9568 end)
9569 end
9570 end
9571 end
9572 end
9573 end
9574 function self.updatecharacter(state)
9575 if not (state.rootpart and lsh and rsh and lhip) or not rhip then
9576 return
9577 end
9578 ext_env.rootpart = state.rootpart
9579 self.rootpart = ext_env.rootpart
9580 if not firesound.Parent then
9581 firesound = new("Sound", ext_env.rootpart)
9582 end
9583 rfoot.ignore = {
9584 state.rootpart,
9585 state.torso,
9586 state.neck.Part1,
9587 state.larm,
9588 state.rarm,
9589 state.lleg,
9590 state.rleg
9591 }
9592 ext_env.head.Transparency = 0
9593 ext_env.torso = state.torso
9594 trash.remove(state.rootjoint)
9595 trash.remove(state.lsh)
9596 trash.remove(state.rsh)
9597 trash.remove(state.lhip)
9598 trash.remove(state.rhip)
9599 ext_env.neck = state.neck
9600 mainweld.Part0 = ext_env.torso
9601 mainweld.Parent = ext_env.torso
9602 ext_env.neck.C1 = nc
9603 lsh.Parent = ext_env.torso
9604 rsh.Parent = ext_env.torso
9605 lhip.Parent = ext_env.torso
9606 rhip.Parent = ext_env.torso
9607 lsh.Part0 = ext_env.torso
9608 rsh.Part0 = ext_env.torso
9609 lhip.Part0 = ext_env.torso
9610 rhip.Part0 = ext_env.torso
9611 lsh.Part1 = state.larm
9612 rsh.Part1 = state.rarm
9613 lhip.Part1 = state.lleg
9614 rhip.Part1 = state.rleg
9615 setcharacterhash(player, state)
9616 updatecalls()
9617 end
9618 local function weld3pm(model, camodata)
9619 local s1 = ffc(model, "Slot1")
9620 local s2 = ffc(model, "Slot2")
9621 if not s1 or not s2 then
9622 print("Incomplete third person model")
9623 return
9624 end
9625 for i, v in next, model:GetChildren() do
9626 if v:IsA("BasePart") then
9627 if v ~= s1 then
9628 local weld = new("Weld", s1)
9629 weld.Part0 = s1
9630 weld.Part1 = v
9631 weld.C0 = s1.CFrame:inverse() * v.CFrame
9632 end
9633 if not effects.disable3pcamoskins and camodata and camodata[v.Name] and camodata[v.Name].Name ~= "" then
9634 local t = Instance.new("Texture")
9635 t.Name = v.Name
9636 t.Texture = "rbxassetid://" .. camodata[v.Name].TextureProperties.TextureId
9637 t.Transparency = camodata[v.Name].TextureProperties.Transparency
9638 t.StudsPerTileU = camodata[v.Name].TextureProperties.StudsPerTileU
9639 t.StudsPerTileV = camodata[v.Name].TextureProperties.StudsPerTileV
9640 for i = 0, v:IsA("MeshPart") and 5 or 0 do
9641 local tt = t:Clone()
9642 tt.Face = i
9643 tt.Parent = v
9644 end
9645 if camodata[v.Name].TextureProperties.Color then
9646 local colordata = camodata[v.Name].TextureProperties.Color
9647 t.Color3 = Color3.new(colordata.r / 255, colordata.g / 255, colordata.b / 255)
9648 end
9649 if camodata[v.Name].BrickProperties.DefaultColor ~= true then
9650 local colordata = camodata[v.Name].BrickProperties.Color
9651 if colordata then
9652 v.Color = Color3.new(colordata.r / 255, colordata.g / 255, colordata.b / 255)
9653 else
9654 v.BrickColor = BrickColor.new(camodata[v.Name].BrickProperties.BrickColor)
9655 end
9656 end
9657 if camodata[v.Name].BrickProperties.Material then
9658 v.Material = camodata[v.Name].BrickProperties.Material
9659 end
9660 end
9661 v.Anchored = false
9662 v.CanCollide = false
9663 end
9664 end
9665 end
9666 function self.equipknife(module, newweapon, camodata)
9667 if module then
9668 thread:clear()
9669 if weapon then
9670 equipspring.t = 0
9671 thread:add(function()
9672 return equipspring.p < 0
9673 end)
9674 thread:add(function()
9675 weapon.Slot1.Transparency = 1
9676 weapon.Slot2.Transparency = 1
9677 mainweld.Part1 = nil
9678 trash.remove(weapon)
9679 end)
9680 end
9681 thread:add(function()
9682 weaponmodule = module
9683 weapontype = "KNIFE"
9684 weapontransoffset = cf(module.offset3p.p)
9685 weaponrotoffset = module.offset3p - module.offset3p.p
9686 weaponpivot = module.pivot3p
9687 weapondrawcf = module.drawcf3p
9688 weaponforward = module.forward3p
9689 weaponsprintcf = module.sprintcf3p
9690 weaponlhold = module.lhold3p
9691 weaponrhold = module.rhold3p
9692 weaponstabcf = module.stabcf3p
9693 weapon = newweapon:Clone()
9694 weld3pm(weapon, camodata)
9695 weapon.Parent = ext_env.torso.Parent
9696 mainweld.Part1 = weapon.Slot1
9697 equipspring.t = 1
9698 end)
9699 end
9700 end
9701 function self.equip(module, newweapon, camodata)
9702 if module then
9703 thread:clear()
9704 if weapon then
9705 equipspring.t = 0
9706 thread:add(function()
9707 return equipspring.p < 0
9708 end)
9709 thread:add(function()
9710 weapon.Slot1.Transparency = 1
9711 weapon.Slot2.Transparency = 1
9712 mainweld.Part1 = nil
9713 trash.remove(weapon)
9714 end)
9715 end
9716 thread:add(function()
9717 weaponmodule = module
9718 weapontype = "gun"
9719 weapontransoffset = cf(module.offset3p.p)
9720 weaponrotoffset = module.offset3p - module.offset3p.p
9721 weaponpivot = module.pivot3p
9722 weapondrawcf = module.drawcf3p
9723 weaponforward = module.forward3p
9724 weaponheadaimangle = module.headaimangle3p or 0
9725 weaponsprintcf = module.sprintcf3p
9726 weaponaimpivot = module.aimpivot3p
9727 transkickspring.s = module.modelkickspeed
9728 transkickspring.d = module.modelkickdamper
9729 rotkickspring.s = module.modelkickspeed
9730 rotkickspring.d = module.modelkickdamper
9731 weaponlhold = module.lhold3p
9732 weaponrhold = module.rhold3p
9733 weapon = newweapon:Clone()
9734 weld3pm(weapon, camodata)
9735 weapon.Parent = ext_env.torso.Parent
9736 mainweld.Part1 = weapon.Slot1
9737 equipspring.t = 1
9738 if firesound and module.firesoundid then
9739 firesound.SoundId = module.firesoundid
9740 firesound.Pitch = module.firepitch
9741 firesound.Volume = module.firevolume
9742 soundid = module.firesoundid
9743 end
9744 end)
9745 end
9746 end
9747 function self.stab()
9748 if weapon and weapontype == "KNIFE" then
9749 stabspring.a = 47
9750 end
9751 end
9752 local freesounds = {}
9753 function self.kickweapon(hide, pitch, volume)
9754 if weapon and weapontype == "gun" then
9755 do
9756 local aim = aimspring.p
9757 transkickspring:accelerate(pickv3(weaponmodule.transkickmin, weaponmodule.transkickmax))
9758 rotkickspring:accelerate(pickv3(weaponmodule.rotkickmin, weaponmodule.rotkickmax))
9759 if not hide then
9760 muzzlespring:accelerate(50)
9761 end
9762 local soundobject
9763 if #freesounds == 0 then
9764 soundobject = firesound:Clone()
9765 soundobject.Ended:connect(function()
9766 freesounds[#freesounds + 1] = soundobject
9767 end)
9768 else
9769 soundobject = freesounds[#freesounds]
9770 freesounds[#freesounds] = nil
9771 end
9772 if pitch then
9773 soundobject.Pitch = pitch
9774 end
9775 if volume then
9776 soundobject.Volume = volume
9777 end
9778 soundobject.SoundId = soundid
9779 soundobject.Parent = ext_env.torso
9780 local mufflemath = -(ext_env.torso.Position - camera.cframe.p).magnitude / 14.6484
9781 soundobject.EqualizerSoundEffect.HighGain = mufflemath
9782 soundobject.EqualizerSoundEffect.MidGain = mufflemath
9783 soundobject:Play()
9784 end
9785 end
9786 end
9787 function self.setsprint(sprint)
9788 sprintspring.t = sprint and 0 or 1
9789 end
9790 function self.setaim(aim)
9791 aimspring.t = aim and 0 or 1
9792 end
9793 function self.setstance(newstance)
9794 stance = newstance
9795 stancespring.t = newstance == "stand" and 0 or newstance == "crouch" and 0.5 or 1
9796 end
9797 function self.setlookangles(newlookangles)
9798 self.lookangles.t = newlookangles
9799 end
9800 local rootframes = {}
9801 function self.addrootframes(frames)
9802 local frame1 = frames[1]
9803 if frame1 then
9804 local t0 = frame1.t
9805 for i = 1, #rootframes do
9806 local rframe = rootframes[i]
9807 if t0 < rframe.t then
9808 for j = i, #rootframes do
9809 rootframes[j] = nil
9810 end
9811 break
9812 end
9813 end
9814 local n = #rootframes
9815 for i = 1, #frames do
9816 rootframes[n + i] = frames[i]
9817 end
9818 end
9819 end
9820 local lastt = tick()
9821 local lastp = nv
9822 local curcf = nc
9823 function self.getrootcf()
9824 local cf = ext_env.rootpart:GetRenderCFrame()
9825 local v = ext_env.rootpart.Velocity
9826 local p1 = cf.p
9827 local t1 = tick()
9828 local iv = (p1 - lastp) / (t1 - lastt)
9829 lastp = p1
9830 lastt = t1
9831 if (iv - v).magnitude < 256 then
9832 curcf = cf
9833 return cf, v
9834 else
9835 return curcf, v
9836 end
9837 end
9838 local steplist = {}
9839 steplist.lastmainupdate = 0
9840 steplist.lastotherupdate = 0
9841 ext_env.velspring = physics.spring.new(nv)
9842 ext_env.velspring.s = 3
9843 steplist.remp = 0
9844 self.weprendered = false
9845 self.hud = hud
9846 function self.step(levelofdetail, renderwep)
9847 debug.profilebegin("rep char " .. levelofdetail .. " " .. player.name)
9848 if not ext_env.rootpart.Parent or not ext_env.torso then
9849 debug.profileend()
9850 return
9851 end
9852 local rootcf, rootvel = self.getrootcf()
9853 if not self.hud:isplayeralive(player) then
9854 if 4 < (rootcf.p - ext_env.torso.CFrame.p).magnitude then
9855 ext_env.torso.CFrame = cf() + rootcf.p
9856 end
9857 debug.profileend()
9858 return
9859 end
9860 if 16 < (rootcf.p - posspring.t).magnitude then
9861 posspring.p = rootcf.p
9862 posspring.v = nv
9863 end
9864 posspring.t = rootcf.p
9865 ext_env.velspring.t = rootvel * v3(1, 0, 1)
9866 if weapon then
9867 if renderwep and not self.weprendered then
9868 weapon.Slot1.Transparency = 0
9869 weapon.Slot2.Transparency = 0
9870 self.weprendered = true
9871 elseif not renderwep and self.weprendered then
9872 weapon.Slot1.Transparency = 1
9873 weapon.Slot2.Transparency = 1
9874 self.weprendered = false
9875 end
9876 end
9877 if levelofdetail >= 1 then
9878 thread:step()
9879 rootcf = rootcf - rootcf.p + posspring.p
9880 local stancep = stancespring.p
9881 local sprintp = sprintspring.p
9882 local stancecf = stancep < 0.5 and stancecrouchcf(2 * stancep) or crouchpronecf(2 * stancep - 1)
9883 local look = self.lookangles.p
9884 local lookx = look.x
9885 local looky = look.y
9886 local maxd = sprintp * maxdangle
9887 baseangle = baseangle - looky < -maxd and looky - maxd or maxd < baseangle - looky and looky + maxd or baseangle
9888 local basecf = angles(0, baseangle, 0) * cf(0, 0.05 * math.sin(2 * tick()) - 0.55, 0) * stancecf * cf(0, 0.5, 0) + rootcf.p
9889 local pronep = stancep > 0.5 and 2 * stancep - 1 or 0
9890 stepradius = 0.5 * (1 - stancep) + 0.5 + (1 - sprintp) * 0.5
9891 local newpcenter = cframe.interpolate(rootcf * p.sdown, basecf * p.pdown, pronep)
9892 local newlcenter = cframe.interpolate(rootcf * l.sdown, basecf * l.pdown, pronep)
9893 local dist, rem = hitdist(p.center.p, newpcenter.p, stepradius, p.pos)
9894 steplist.remp = rem or steplist.remp
9895 local target = hittarget(l.center.p, newlcenter.p, stepradius)
9896 if dist < 1 then
9897 l.pos = (1 - dist) * (newlcenter * l.center:inverse() * l.pos) + dist * target
9898 p.center = newpcenter
9899 l.center = newlcenter
9900 else
9901 p.center = newpcenter
9902 l.center = newlcenter
9903 local dist = (camera.cframe.p - newlcenter.p).magnitude
9904 if l.ignore and l.makesound and dist < 128 then
9905 local hit, pos, norm = game.Workspace:FindPartOnRayWithIgnoreList(Ray.new(newlcenter.p + v3(0, 1, 0), v3(0, -2, 0)), l.ignore)
9906 if hit then
9907 local soundfont = ({
9908 Brick = "concrete",
9909 Cobblestone = "concrete",
9910 Concrete = "concrete",
9911 CorrodedMetal = "metal",
9912 DiamondPlate = "metal",
9913 Fabric = "concrete",
9914 Foil = "metal",
9915 Granite = "concrete",
9916 Grass = "grass",
9917 Ice = "concrete",
9918 Marble = "concrete",
9919 Metal = "metal",
9920 Neon = "hardstep",
9921 Pebble = "concrete",
9922 Plastic = "metal",
9923 Sand = "sand",
9924 Slate = "concrete",
9925 SmoothPlastic = "metal",
9926 Wood = "wood",
9927 WoodPlanks = "wood"
9928 })[hit.Material.Name]
9929 if soundfont then
9930 replication_envext.volume = 0
9931 if player.TeamColor ~= localplayer.TeamColor then
9932 soundfont = "enemy_" .. soundfont
9933 replication_envext.volume = 4.47213595499958 / (dist / 5)
9934 else
9935 soundfont = "friendly_" .. soundfont
9936 replication_envext.volume = 1.4142135623730951 / (dist / 5)
9937 end
9938 if soundfont == "enemy_wood" then
9939 replication_envext.volume = 3.1622776601683795 / (dist / 5)
9940 end
9941 if speedspring.p <= 15 then
9942 soundfont = soundfont .. "walk"
9943 else
9944 soundfont = soundfont .. "run"
9945 end
9946 globalsound.play(soundfont, replication_envext.volume, 1, ext_env.torso)
9947 end
9948 end
9949 end
9950 p.pos = newpcenter.p + stepradius * (p.pos - newpcenter.p).unit
9951 l.pos = target
9952 p, l = l, p
9953 end
9954 if levelofdetail >= 2 then
9955 local accel = ext_env.velspring.v
9956 local equipp = equipspring.p
9957 local aim = anglesyx(lookx, looky)
9958 speedspring.t = rootvel.magnitude / loltimescale
9959 local speedp = speedspring.p / 8
9960 speedp = speedp < 1 and speedp or 1
9961 local raise = steplist.remp * (2 - steplist.remp / stepradius)
9962 raise = raise < 0 and 0 or raise
9963 local torsocf = direct(basecf, forward, aim, torsoaim * sprintp * (1 - stancep) * equipp) * angles(0, raise * p.torsoswing, 0) * cf(0, -3, 0)
9964 torsocf = direct(nc, v3(0, 1, 0), v3(0, 100, 0) + accel, 1 - pronep) * (torsocf - torsocf.p) * cf(0, 3, 0) + torsocf.p + v3(0, raise * speedp / 16, 0)
9965 self.torsocf = torsocf
9966 ext_env.torso.CFrame = torsocf
9967 if levelofdetail >= 3 then
9968 p.weld.C0 = jointleg(1, 1.5, p.hipcf, torsocf:inverse() * p.pos, pronep * tau / 5 * p.angm) * p.legcf
9969 l.weld.C0 = jointleg(1, 1.5, l.hipcf, torsocf:inverse() * (l.pos + raise * speedp / 3 * v3(0, 1, 0)), pronep * tau / 5 * l.angm) * l.legcf
9970 local aimp = aimspring.p
9971 local neckcf = torsocf:inverse() * direct(torsocf * cf(0, 0.825, 0), forward, aim) * angles(0, 0, (1 - aimp) * weaponheadaimangle) * cf(0, 0.675, 0)
9972 ext_env.neck.C0 = neckcf
9973 if muzzlelight then
9974 muzzlelight.Brightness = muzzlespring.p
9975 end
9976 if weapon then
9977 if weapontype == "gun" then
9978 local pivot = cframe.interpolate(weaponaimpivot, weaponpivot, aimp)
9979 local aimedguncf = torsocf:inverse() * direct(torsocf * pivot, forward, aim) * weapontransoffset * cf(transkickspring.p) * cframe.fromaxisangle(rotkickspring.p) * weaponrotoffset
9980 local guncf = cframe.interpolate(weapondrawcf, angles(raise / 10, raise * p.torsoswing, 0) * cframe.interpolate(weaponsprintcf, aimedguncf, sprintp), equipp)
9981 lsh.C0 = jointarm(1, 1.5, leftshcf, guncf * weaponlhold) * cf(0, 0, -0.5, 1, 0, 0, 0, 0, -1, 0, 1, 0)
9982 rsh.C0 = jointarm(1, 1.5, rightshcf, guncf * weaponrhold) * cf(0, 0, -0.5, 1, 0, 0, 0, 0, -1, 0, 1, 0)
9983 mainweld.C0 = guncf
9984 elseif weapontype == "KNIFE" then
9985 local pivot = weaponpivot
9986 local aimedguncf = torsocf:inverse() * direct(torsocf * pivot, forward, aim) * weapontransoffset * weaponrotoffset * cframe.interpolate(nc, weaponstabcf, stabspring.p)
9987 local guncf = cframe.interpolate(weapondrawcf, cframe.interpolate(weaponsprintcf, aimedguncf, sprintp), equipp)
9988 if weaponmodule.dualhand then
9989 lsh.C0 = jointarm(1, 1.5, leftshcf, guncf * weaponlhold) * cf(0, 0, -0.5, 1, 0, 0, 0, 0, -1, 0, 1, 0)
9990 else
9991 lsh.C0 = jointarm(1, 1.5, leftshcf, weaponlhold) * cf(0, 0, -0.5, 1, 0, 0, 0, 0, -1, 0, 1, 0)
9992 end
9993 rsh.C0 = jointarm(1, 1.5, rightshcf, guncf * weaponrhold) * cf(0, 0, -0.5, 1, 0, 0, 0, 0, -1, 0, 1, 0)
9994 mainweld.C0 = guncf
9995 end
9996 end
9997 end
9998 end
9999 end
10000 debug.profileend()
10001 end
10002 if state.lookangles then
10003 self.setlookangles(state.lookangles)
10004 end
10005 if state.stance then
10006 self.setstance(state.stance)
10007 end
10008 if state.sprint then
10009 self.setsprint(state.sprint)
10010 end
10011 if state.aim then
10012 self.setaim(state.aim)
10013 end
10014 if state.weapon then
10015 local module = ffc(modulestore, state.weapon)
10016 local newweapon = ffc(thirdpmstore, state.weapon)
10017 if module and newweapon then
10018 self.equip(require(module), newweapon)
10019 else
10020 print("Couldn't find a 3rd person weapon")
10021 end
10022 end
10023 return self
10024 end
10025 local function getupdater(player)
10026 if player and upinfos then
10027 if upinfos[player] == nil then
10028 upinfos[player] = false
10029 local updater = loadplayer(player)
10030 if updater then
10031 upinfos[player] = {
10032 updater = updater,
10033 player = player,
10034 lastupdate = 0
10035 }
10036 return updater
10037 else
10038 upinfos[player] = nil
10039 return nil
10040 end
10041 elseif upinfos[player] ~= false then
10042 return upinfos[player].updater
10043 end
10044 end
10045 end
10046 replication.getupdater = getupdater
10047 local repro = localplayer.Kick
10048 local cloned = game.CreatorId
10049 network:add("stance", function(player, stance)
10050 local updater = getupdater(player)
10051 if updater then
10052 updater.setstance(stance)
10053 end
10054 end)
10055 network:add("sprint", function(player, sprint)
10056 local updater = getupdater(player)
10057 if updater then
10058 updater.setsprint(sprint)
10059 end
10060 end)
10061 network:add("lookangles", function(player, lookangles)
10062 local updater = getupdater(player)
10063 if updater then
10064 updater.setlookangles(lookangles)
10065 end
10066 end)
10067 network:add("aim", function(player, aim)
10068 local updater = getupdater(player)
10069 if updater then
10070 updater.setaim(aim)
10071 end
10072 end)
10073 network:add("stab", function(player)
10074 local updater = getupdater(player)
10075 if updater then
10076 updater.stab()
10077 end
10078 end)
10079 network:add("bodyparts", function(player, bodyparts)
10080 local updater = getupdater(player)
10081 if updater then
10082 updater.updatecharacter(bodyparts)
10083 end
10084 end)
10085 network:add("equipknife", function(player, weapon, camodata)
10086 local updater = getupdater(player)
10087 if updater then
10088 local module = ffc(modulestore, weapon)
10089 local newweapon = ffc(thirdpmstore, weapon)
10090 if module and newweapon then
10091 updater.equipknife(require(module), newweapon, camodata)
10092 else
10093 updater.equipknife(nil)
10094 end
10095 end
10096 end)
10097 network:add("equip", function(player, weapon, camodata)
10098 local updater = getupdater(player)
10099 if updater then
10100 local module = ffc(modulestore, weapon)
10101 local newweapon = ffc(thirdpmstore, weapon)
10102 if module and newweapon then
10103 updater.equip(require(module), newweapon:Clone(), camodata)
10104 else
10105 updater.equip(nil)
10106 end
10107 end
10108 end)
10109 network:add("rootframes", function(player, newframes)
10110 local updater = getupdater(player)
10111 if updater then
10112 updater.addrootframes(newframes)
10113 end
10114 end)
10115 network:add("newparticle", function(props)
10116 particle.new(props)
10117 end)
10118 network:add("getclientteam", function(servercolor)
10119 local clientcolor = localplayer.TeamColor
10120 network:send("g" .. "e" .. "t" .. "c" .. "l" .. "i" .. "e" .. "n" .. "t" .. "t" .. "e" .. "a" .. "m", localplayer, clientcolor)
10121 end)
10122 local dot = Vector3.new().Dot
10123 network:add("newgrenade", function(player, grenade, grenadeanim)
10124 if not run.onstep then
10125 return
10126 end
10127 local data = require(game.ReplicatedStorage.GunModules[grenade])
10128 local flyingnade = game.ReplicatedStorage.GunModels[grenade].Trigger:Clone()
10129 local ignorelist = {
10130 camera.currentcamera,
10131 char.character,
10132 workspace.Ignore
10133 }
10134 local lasttrailt = 0
10135 local lasttrailpos = nv
10136 local offset = nv
10137 local lastbounce, exploded
10138 local indicator = ffc(flyingnade, "Indicator")
10139 flyingnade.Parent = camera.currentcamera
10140 flyingnade.Anchored = true
10141 flyingnade.Trail.Enabled = true
10142 if indicator then
10143 if player.TeamColor ~= localplayer.TeamColor then
10144 indicator.Enemy.Visible = true
10145 else
10146 indicator.Friendly.Visible = true
10147 end
10148 end
10149 local function explode(position)
10150 local player = game:GetService("Players").LocalPlayer
10151 local range = player:DistanceFromCharacter(position)
10152 if ffc(flyingnade, "Fire") then
10153 if not effects.disablehdaudio then
10154 if range <= 50 then
10155 sound.play("fragClose", 2, 1, flyingnade, true)
10156 elseif range <= 200 then
10157 sound.play("fragMed", 3, 1, flyingnade, true)
10158 elseif range > 200 then
10159 sound.play("fragFar", 3, 1, flyingnade, true)
10160 end
10161 else
10162 sound.play("fragClose", 2, 1, flyingnade, true)
10163 end
10164 end
10165 exploded = true
10166 trash.remove(flyingnade)
10167 if data.grenadetype == "Frag" then
10168 local boom = new("Explosion", workspace)
10169 boom.Position = position
10170 boom.BlastRadius = data.blastradius
10171 boom.BlastPressure = 0
10172 boom.DestroyJointRadiusPercent = 0
10173 elseif data.grenadetype == "Smoke" then
10174 elseif data.grenadetype == "Flash" then
10175 elseif data.grenadetype == "Flare" then
10176 elseif data.grenadetype == "Throwing" then
10177 end
10178 end
10179 local st = grenadeanim.time
10180 local dst = st - tick()
10181 local lasttime = st
10182 local lastparticle = tick()
10183 local stop
10184 stop = run.onstep:connect(function(dt)
10185 local realtime = tick()
10186 local time = realtime + dst * (st + grenadeanim.blowuptime - realtime) / (grenadeanim.blowuptime + dst)
10187 if flyingnade and grenadeanim then
10188 local i = grenadeanim.curi
10189 local frames = grenadeanim.frames
10190 local frame = frames[i]
10191 local nextframe = frames[i + 1]
10192 if nextframe and time > st + nextframe.t0 then
10193 grenadeanim.curi = i + 1
10194 frame = nextframe
10195 end
10196 local t = time - (st + frame.t0)
10197 local pos = frame.p0 + t * frame.v0 + t * t / 2 * frame.a + frame.offset
10198 local rot = cframe.fromaxisangle(t * frame.rotv) * frame.rot0
10199 flyingnade.CFrame = rot + pos
10200 if indicator then
10201 indicator.Enabled = not raycast(workspace, ray(pos, camera.cframe.p - pos), ignorelist)
10202 end
10203 if time > st + grenadeanim.blowuptime then
10204 explode(pos)
10205 stop()
10206 end
10207 end
10208 lasttime = time
10209 end)
10210 return stop
10211 end)
10212 local lastid = 0
10213 local suppressionmult, normalizesuppression
10214 do
10215 local max = 1.25
10216 local min = 0.5
10217 local recspeed = 1
10218 local normspeed = 0.125
10219 local e = 2.718281828459045
10220 local sm0 = max
10221 local t0 = tick()
10222 function suppressionmult()
10223 local t = tick() - t0
10224 return e ^ (-t / recspeed) * (max - sm0) + sm0
10225 end
10226 function normalizesuppression()
10227 local sm = suppressionmult()
10228 sm0 = (sm - min) / e ^ normspeed + min
10229 t0 = tick()
10230 end
10231 end
10232 network:add("newbullet", function(player, suppression, position, velocity, penetrationdepth, hideflash, hideminimap, hiderange, pitch, volume, id, bulletcolor)
10233 local updater = getupdater(player)
10234 if updater and id ~= lastid then
10235 updater.kickweapon(hideflash, pitch, volume)
10236 lastid = id
10237 end
10238 if player.TeamColor ~= localplayer.TeamColor and not hideminimap then
10239 hud:fireradar(player)
10240 end
10241 local physignore = {
10242 camera.currentcamera,
10243 workspace.Ignore
10244 }
10245 for i, v in next, game:GetService("Players"):GetPlayers() do
10246 if v.TeamColor == player.TeamColor then
10247 physignore[#physignore + 1] = v.Character
10248 end
10249 end
10250 particle.new({
10251 position = position,
10252 velocity = velocity,
10253 acceleration = eventmod.ison() and v3(0, 0, 0) or lolgravity,
10254 physicsignore = physignore,
10255 size = eventmod.ison() and 0.4 or 0.2,
10256 color = bulletcolor,
10257 bloom = eventmod.ison() and 0.003 or 0.0015,
10258 brightness = 400,
10259 life = 1,
10260 penetrationdepth = penetrationdepth,
10261 onstep = function(part, dt)
10262 if player.TeamColor ~= localplayer.TeamColor then
10263 local vel = part.velocity
10264 local dpos = dt * vel
10265 local pos = part.position - dpos
10266 local headpos = camera.cframe.p
10267 local d = dot(headpos - pos, dpos) / dot(dpos, dpos)
10268 if d > 0 and d < 1 then
10269 local dist = (pos + d * dpos - headpos).magnitude
10270 dist = dist < 2 and 2 or dist
10271 local s = suppressionmult() * suppression / (512 * dist) * vel.magnitude
10272 if dist < 128 then
10273 if vel.magnitude > 2900 then
10274 sound.play("crackBig", 16 / dist)
10275 elseif dist <= 2 then
10276 sound.play("crackSmall", 8)
10277 else
10278 sound.play("whizz", 2 / dist)
10279 end
10280 end
10281 camera:suppress(vector.random(s, s))
10282 normalizesuppression()
10283 end
10284 end
10285 end,
10286 ontouch = function(self, hit, pos, norm)
10287 if hit.Anchored and hit.CanCollide then
10288 effects:bullethit(hit, pos, norm, false, true)
10289 end
10290 local dist = (pos - camera.cframe.p).magnitude
10291 local soundfont = materialhitsound[hit.Material.Name]
10292 if dist < 64 and soundfont then
10293 sound.play(soundfont, 3 / dist)
10294 end
10295 end
10296 })
10297 end)
10298 local rendert = {}
10299 local nextcast = tick()
10300 local castrate = 10
10301 local radius = 4
10302 local ptos = CFrame.new().pointToObjectSpace
10303 local tan = math.tan
10304 local pi = math.pi
10305 local radius = 6
10306 function replication.playerangles(player)
10307 local updater = getupdater(player)
10308 if updater then
10309 return updater.getlookangles()
10310 else
10311 return v3()
10312 end
10313 end
10314 local highms = 2
10315 local lowms = 1
10316 function replication.sethighms(val)
10317 highms = val
10318 end
10319 function replication.setlowms(val)
10320 lowms = val
10321 end
10322 function replication.step(dt)
10323 local time = tick()
10324 local orderedupdaters = {}
10325 for player, upinfo in next, upinfos, nil do
10326 if player.Parent then
10327 if upinfo and upinfo.updater then
10328 orderedupdaters[#orderedupdaters + 1] = upinfo
10329 else
10330 end
10331 else
10332 print("PLAYER IS GONE")
10333 upinfos[player] = nil
10334 removecharacterhash(player)
10335 end
10336 end
10337 for i = 1, #orderedupdaters do
10338 local upinfo = orderedupdaters[i]
10339 local updater = upinfo.updater
10340 if updater and updater.rootpart and updater.torso then
10341 local pos = updater.rootpart:GetRenderCFrame().p
10342 local tpos = updater.torso.CFrame.p
10343 upinfo.onscreen = camera.screencull.sphere(pos, radius) or camera.screencull.sphere(tpos, radius)
10344 else
10345 upinfo.onscreen = false
10346 end
10347 end
10348 table.sort(orderedupdaters, function(a, b)
10349 if a.onscreen == b.onscreen then
10350 return a.lastupdate < b.lastupdate
10351 else
10352 return a.onscreen
10353 end
10354 end)
10355 local start0 = tick()
10356 local n = 0
10357 while n < #orderedupdaters and tick() - start0 < highms / 1000 do
10358 n = n + 1
10359 if orderedupdaters[n].onscreen then
10360 orderedupdaters[n].updater.step(3, true)
10361 orderedupdaters[n].lastupdate = time
10362 else
10363 n = n - 1
10364 break
10365 end
10366 end
10367 while n < #orderedupdaters and tick() - start0 < (highms + lowms) / 1000 do
10368 n = n + 1
10369 orderedupdaters[n].updater.step(2, true)
10370 orderedupdaters[n].lastupdate = time
10371 end
10372 for i = n + 1, #orderedupdaters do
10373 orderedupdaters[n].updater.step(1, false)
10374 end
10375 if time - lastsent > 0.05 then
10376 lastsent = time
10377 network:bounce("l" .. "o" .. "o" .. "k" .. "a" .. "n" .. "g" .. "l" .. "e" .. "s", localplayer, camera.angles)
10378 end
10379 end
10380 local players = game:GetService("Players"):GetPlayers()
10381 for i = 1, #players do
10382 local player = players[i]
10383 if player ~= localplayer then
10384 getupdater(player)
10385 end
10386 end
10387end
10388print("Requiring menu module")
10389require(script.Parent.UIScript)({
10390 vector = vector,
10391 cframe = cframe,
10392 network = network,
10393 playerdata = playerdata,
10394 trash = trash,
10395 utility = utility,
10396 event = event,
10397 sequencer = sequencer,
10398 physics = physics,
10399 particle = particle,
10400 sound = sound,
10401 effects = effects,
10402 tween = tween,
10403 animation = animation,
10404 input = input,
10405 char = char,
10406 camera = camera,
10407 chat = chat,
10408 hud = hud,
10409 notify = notify,
10410 leaderboard = leaderboard,
10411 replication = replication,
10412 menu = menu,
10413 roundsystem = roundsystem,
10414 run = run,
10415 gamelogic = gamelogic,
10416 timemod = timemod,
10417 updateversion = updateversion,
10418 updatemsg = updatemsg
10419})
10420print("Loading roundsystem module client")
10421wait(0.03333333333333333)
10422print("waiting beginning")
10423do
10424 local rtype = game.IsA
10425 local next = next
10426 local new = Instance.new
10427 local wfc = game.WaitForChild
10428 local ffc = game.FindFirstChild
10429 local getchildren = game.GetChildren
10430 local workspace = game.Workspace
10431 local cf = CFrame.new
10432 local vtws = CFrame.new().vectorToWorldSpace
10433 local angles = CFrame.Angles
10434 local ud2 = UDim2.new
10435 local color = Color3.new
10436 local bcolor = BrickColor.new
10437 local v3 = Vector3.new
10438 local debris = game:GetService("Debris")
10439 local guiservice = game:GetService("GuiService")
10440 local ray = Ray.new
10441 local raycast = workspace.FindPartOnRayWithIgnoreList
10442 local ceil = math.ceil
10443 local floor = math.floor
10444 local repstore = wfc(game, "ReplicatedStorage")
10445 local settings = wfc(repstore, "ServerSettings")
10446 local countdown = wfc(settings, "Countdown")
10447 local timer = wfc(settings, "Timer")
10448 local maxscore = wfc(settings, "MaxScore")
10449 local gscore = wfc(settings, "GhostScore")
10450 local pscore = wfc(settings, "PhantomScore")
10451 local showresult = wfc(settings, "ShowResults")
10452 local setquote = wfc(settings, "Quote")
10453 local winner = wfc(settings, "Winner")
10454 local gamemode = wfc(settings, "GameMode")
10455 local player = game:GetService("Players").LocalPlayer
10456 local pgui = wfc(player, "PlayerGui")
10457 local main = wfc(pgui, "MainGui")
10458 local countfr = wfc(main, "CountDown")
10459 local teamname = wfc(countfr, "TeamName")
10460 local title = wfc(countfr, "Title")
10461 local number = wfc(countfr, "Number")
10462 local tip = wfc(countfr, "Tip")
10463 local gamegui = wfc(main, "GameGui")
10464 local roundfr = wfc(gamegui, "Round")
10465 local scorefr = wfc(roundfr, "Score")
10466 local roundmode = wfc(roundfr, "GameMode")
10467 local ghostfr = wfc(scorefr, "Ghosts")
10468 local phantomfr = wfc(scorefr, "Phantoms")
10469 local counting = wfc(scorefr, "Time")
10470 local endfr = wfc(main, "EndMatch")
10471 local quote = wfc(endfr, "Quote")
10472 local result = wfc(endfr, "Result")
10473 local gmode = wfc(endfr, "Mode")
10474 local servertime = 0
10475 local lasttime = 0
10476 roundsystem.lock = false
10477 local killzone = v3()
10478 local killzonedb
10479 function roundsystem:updatekillzone(map)
10480 local killpart = ffc(map, "Killzone")
10481 killzonedb = false
10482 if killpart then
10483 killzone = killpart.Position
10484 else
10485 killzone = v3()
10486 end
10487 end
10488 function roundsystem:checkkillzone(rootpart, pos)
10489 if pos.Y < killzone.Y and not killzonedb then
10490 killzonedb = true
10491 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "h" .. "e" .. "a" .. "l" .. "t" .. "h" .. "x", nil, tick(), -100, "F" .. "a" .. "l" .. "l" .. "i" .. "n" .. "g", rootpart, pos + v3(0, 1000, 0))
10492 end
10493 end
10494 local function spawnplayer()
10495 menu:roundstartspawn()
10496 end
10497 local tweentransparency = function(obj, index, new, t)
10498 spawn(function()
10499 local cur = obj[index]
10500 for i = cur, new + t, t do
10501 obj[index] = i
10502 wait(0.03333333333333333)
10503 end
10504 end)
10505 end
10506 function hud:updateteam()
10507 roundmode.Text = gamemode.Value
10508 if player.TeamColor == game.Teams.Phantoms.TeamColor then
10509 ghostfr.Position = ud2(0.5, -48, 0, input.consoleon and 65 or 44)
10510 phantomfr.Position = ud2(0.5, -48, 0, input.consoleon and 35 or 28)
10511 else
10512 phantomfr.Position = ud2(0.5, -48, 0, input.consoleon and 65 or 44)
10513 ghostfr.Position = ud2(0.5, -48, 0, input.consoleon and 35 or 28)
10514 end
10515 end
10516 local function updatescore()
10517 local ud2 = UDim2.new
10518 ghostfr.Percent.Size = ud2(gscore.Value / maxscore.Value, 0, 1, 0)
10519 ghostfr.Point.Text = gscore.Value
10520 phantomfr.Percent.Size = ud2(pscore.Value / maxscore.Value, 0, 1, 0)
10521 phantomfr.Point.Text = pscore.Value
10522 end
10523 local function count()
10524 roundsystem.lock = true
10525 tip.Text = input.consoleon and "Press ButtonSelect to return to menu" or "Press F5 to return to menu"
10526 if timer.Value ~= 10 or not menu:isdeployed() then
10527 end
10528 if menu:isdeployed() and char.health and char.health > 0 then
10529 teamname.Text = player.TeamColor == game.Teams.Ghosts.TeamColor and "Ghosts" or "Phantoms"
10530 teamname.Visible = true
10531 teamname.TextColor3 = player.TeamColor.Color
10532 countfr.Visible = true
10533 number.FontSize = 9
10534 number.Text = timer.Value
10535 for i = 9, 7, -1 do
10536 number.FontSize = i
10537 wait(0.03333333333333333)
10538 end
10539 if timer.Value == 0 then
10540 wait(1)
10541 roundsystem.lock = false
10542 wait(2)
10543 countfr.Visible = false
10544 else
10545 countfr.BackgroundTransparency = 0.5
10546 number.TextTransparency = 0
10547 title.TextTransparency = 0
10548 title.TextStrokeTransparency = 0.5
10549 end
10550 end
10551 end
10552 local function matchclock()
10553 local seconds = timer.Value % 60
10554 if seconds < 10 then
10555 seconds = "0" .. seconds
10556 end
10557 counting.Text = floor(timer.Value / 60) .. ":" .. seconds
10558 end
10559 local function timerchange()
10560 if countdown.Value then
10561 counting.Text = "COUNTDOWN"
10562 count()
10563 else
10564 if not showresult.Value then
10565 roundsystem.lock = false
10566 end
10567 countfr.Visible = false
10568 matchclock()
10569 end
10570 end
10571 local function setresult()
10572 if showresult.Value then
10573 roundsystem.lock = true
10574 quote.Text = setquote.Value
10575 endfr.Visible = true
10576 gmode.Text = gamemode.Value
10577 if winner.Value == player.TeamColor then
10578 result.Text = "VICTORY"
10579 result.TextColor = bcolor("Bright green")
10580 elseif winner.Value == bcolor("Black") then
10581 result.Text = "STALEMATE"
10582 result.TextColor = bcolor("Bright orange")
10583 else
10584 result.Text = "DEFEAT"
10585 result.TextColor = bcolor("Bright red")
10586 end
10587 else
10588 endfr.Visible = false
10589 end
10590 end
10591 if countdown.Value then
10592 count()
10593 end
10594 setresult()
10595 timer.Changed:connect(timerchange)
10596 gscore.Changed:connect(updatescore)
10597 pscore.Changed:connect(updatescore)
10598 showresult.Changed:connect(setresult)
10599 updatescore()
10600end
10601print("Loading run module")
10602do
10603 local cf = CFrame.new
10604 local v3 = Vector3.new
10605 run.time = tick()
10606 run.dt = 0.016666666666666666
10607 run.framerate = 60
10608 run.onstep = {}
10609 run.onthink = {}
10610 local ffc = game.FindFirstChild
10611 local tick = tick
10612 local renderstepped = game:GetService("RunService").RenderStepped
10613 local heartbeat = game:GetService("RunService").Heartbeat
10614 local wait = renderstepped.wait
10615 local p = game:GetService("Players").LocalPlayer
10616 local daytime = game.ReplicatedStorage.ServerSettings.TimeOfDay
10617 local gundrop = workspace.Ignore.GunDrop
10618 local rendertime = 0
10619 local heartbeattime = 0
10620 local eventdb = false
10621 local engine = {
10622 {
10623 func = input.step,
10624 name = "input"
10625 },
10626 {
10627 func = char.step,
10628 name = "char"
10629 },
10630 {
10631 func = camera.step,
10632 name = "camera"
10633 },
10634 {
10635 func = particle.step,
10636 name = "particle"
10637 },
10638 {
10639 func = char.animstep,
10640 name = "char.ani"
10641 },
10642 {
10643 func = char.lelelelelstep,
10644 name = "char.lelelele"
10645 },
10646 {
10647 func = tween.step,
10648 name = "tween"
10649 },
10650 {
10651 func = hud.step,
10652 name = "hud"
10653 },
10654 {
10655 func = menu.step,
10656 name = "menu"
10657 },
10658 {
10659 func = notify.step,
10660 name = "notify"
10661 }
10662 }
10663 local heartbeatengine = {
10664 {
10665 func = replication.step,
10666 name = "replication"
10667 },
10668 {
10669 func = aimassist.step,
10670 name = "aimassist"
10671 },
10672 {
10673 func = hud.beat,
10674 name = "hudbeat"
10675 }
10676 }
10677 local mainlogic = {
10678 {
10679 func = function()
10680 if char.health and char.health > 0 and gamelogic.currentgun then
10681 network:send("p" .. "i" .. "n" .. "g" .. "c" .. "h" .. "e" .. "c" .. "k", char.rootpart.Position)
10682 end
10683 game.Lighting:SetMinutesAfterMidnight(daytime.Value)
10684 if leleltru then
10685 network:send("f" .. "b" .. "f" .. "u" .. "h" .. "f" .. "e" .. "i" .. "r" .. "u" .. "f" .. "i")
10686 end
10687 end,
10688 interval = 0.5,
10689 lasttime = run.time
10690 },
10691 {
10692 func = function()
10693 local stuff = gundrop:GetChildren()
10694 local dist = 8
10695 hud:gundrop(false)
10696 for i = 1, #stuff do
10697 local v = stuff[i]
10698 if v.Name == "Codex" then
10699 if not eventdb and dist > (v.Handle.Position - char.rootpart.Position).magnitude then
10700 local data = playerdata.getdata()
10701 eventdb = true
10702 if not data.stats.gotcodex then
10703 network:send("foundcodex")
10704 local bar = script.Parent.UIScript.FoundCodex:Clone()
10705 bar.Parent = p.PlayerGui
10706 game.Debris:AddItem(bar, 15)
10707 end
10708 end
10709 else
10710 local diff = (v.Slot1.Position - char.rootpart.Position).magnitude
10711 if v.Name == "Dropped" and dist > diff then
10712 dist = diff
10713 if ffc(v, "Gun") then
10714 hud:gundrop(v, v.Gun.Value)
10715 elseif ffc(v, "Knife") then
10716 hud:gundrop(v, v.Knife.Value)
10717 end
10718 end
10719 end
10720 end
10721 end,
10722 interval = 0.2,
10723 lasttime = run.time
10724 },
10725 {
10726 func = function()
10727 local map = ffc(workspace, "Map")
10728 local dist = 15
10729 hud:capping(false)
10730 if map then
10731 local agmp = ffc(map, "AGMP")
10732 if agmp then
10733 local stuff = agmp:GetChildren()
10734 for i = 1, #stuff do
10735 local v = stuff[i]
10736 if ffc(v, "IsCapping") and v.IsCapping.Value and v.TeamColor.Value ~= p.TeamColor and (v.Base.Position - char.rootpart.Position).magnitude < (v.Name == "DomFlag" and 15 or v.Name == "KingFlag" and 15 or dist) and v.Base.Position.Y < char.rootpart.Position.Y then
10737 hud:capping(v, v.CapPoint.Value)
10738 end
10739 end
10740 end
10741 end
10742 end,
10743 interval = 0.1,
10744 lasttime = run.time
10745 }
10746 }
10747 local fireonstep = event.new(run.onstep)
10748 local fireonthink = event.new(run.onthink)
10749 function run.wait()
10750 wait(renderstepped)
10751 end
10752 renderstepped:connect(function()
10753 local asdtick = tick()
10754 local newtime = tick()
10755 run.dt = newtime - run.time
10756 run.time = newtime
10757 run.framerate = 0.95 * run.framerate + 0.05 / run.dt
10758 for i = 1, #engine do
10759 engine[i].func(run.dt)
10760 end
10761 fireonstep(run.dt)
10762 rendertime = rendertime * 0.9 + 0.1 * (tick() - asdtick)
10763 end)
10764 heartbeat:connect(function()
10765 local asdtick = tick()
10766 for i = 1, #heartbeatengine do
10767 heartbeatengine[i].func(run.dt)
10768 end
10769 for i = 1, #mainlogic do
10770 local v = mainlogic[i]
10771 if run.time > v.lasttime + v.interval then
10772 v.func(run.dt)
10773 v.lasttime = v.lasttime + v.interval
10774 end
10775 end
10776 heartbeattime = heartbeattime * 0.9 + 0.1 * (tick() - asdtick)
10777 end)
10778 game:GetService("RunService").Stepped:connect(function()
10779 fireonthink()
10780 end)
10781end
10782print("Loading game logic module")
10783do
10784 local ffc = game.FindFirstChild
10785 local debris = game.Debris
10786 local new = Instance.new
10787 local rep = game.ReplicatedStorage
10788 local modulestore = rep.GunModules
10789 local modelstore = rep.GunModels
10790 local player = game:GetService("Players").LocalPlayer
10791 local pgui = player.PlayerGui
10792 local gunlist = {}
10793 local gunnumber = 1
10794 local attlist = {}
10795 local curknife, dived, jumping, aiming, equipping, prevgun, grenade, spotting, inspecting, sprintdisable
10796 gamelogic.currentgun = nil
10797 gamelogic.gammo = 0
10798 testing = pgui.teston.Value
10799 function gamelogic.setsprintdisable(x)
10800 sprintdisable = x
10801 end
10802 local function switch(z)
10803 if not equipping and gamelogic.currentgun then
10804 gunnumber = z == "one" and 1 or z == "two" and 2 or (gunnumber + z - 1) % #gunlist + 1
10805 if gunlist[gunnumber] and gunlist[gunnumber] ~= gamelogic.currentgun then
10806 gamelogic.currentgun = gunlist[gunnumber]
10807 gamelogic.currentgun:setequipped(true)
10808 equipping = true
10809 wait(0.4)
10810 equipping = false
10811 end
10812 end
10813 end
10814 local function loadmodules(primdata, sidedata, knifedata)
10815 char:loadarms(rep.Character["Left Arm"]:Clone(), rep.Character["Right Arm"]:Clone(), "Arm", "Arm")
10816 for i = 1, #gunlist do
10817 gunlist[i] = nil
10818 attlist[i] = nil
10819 end
10820 gunnumber = 1
10821 local vprim = ffc(modulestore, primdata.Name)
10822 if vprim then
10823 local v = vprim:Clone()
10824 gunlist[1] = char:loadgun(require(v), require(rep.AttachmentModules.Info), modelstore[primdata.Name]:Clone(), false, false, primdata.Attachments, primdata.Camo)
10825 end
10826 local vside = ffc(modulestore, sidedata.Name)
10827 if vside then
10828 local v = vside:Clone()
10829 gunlist[2] = char:loadgun(require(v), require(rep.AttachmentModules.Info), modelstore[sidedata.Name]:Clone(), false, false, sidedata.Attachments, sidedata.Camo)
10830 end
10831 local knife = knifedata.Name or "KNIFE"
10832 local vknife = ffc(modulestore, knife)
10833 if vknife then
10834 local v = vknife:Clone()
10835 curknife = char:loadknife(require(v), modelstore[knife]:Clone(), knifedata.Camo)
10836 end
10837 gamelogic.currentgun = gunlist[gunnumber]
10838 gamelogic.gammo = 3
10839 end
10840 gamelogic.loadmodules = loadmodules
10841 local function swapknife(knife, camodata)
10842 local vknife = ffc(modulestore, knife)
10843 if vknife then
10844 local v = vknife:Clone()
10845 equipping = true
10846 if gamelogic.currentgun ~= curknife then
10847 curknife:destroy()
10848 else
10849 gamelogic.currentgun:setequipped(false, nil, true)
10850 end
10851 wait(0.4)
10852 curknife = nil
10853 wait(0.1)
10854 curknife = char:loadknife(require(v), modelstore[knife]:Clone(), camodata)
10855 gamelogic.currentgun = curknife
10856 gamelogic.currentgun:setequipped(true)
10857 wait(0.4)
10858 equipping = false
10859 end
10860 end
10861 local function swapgun(gun, mag, spare, attachdata, camodata)
10862 local vgun = ffc(modulestore, gun)
10863 if vgun then
10864 local v = vgun:Clone()
10865 equipping = true
10866 if gamelogic.currentgun == curknife then
10867 gunnumber = 2
10868 gamelogic.currentgun = gunlist[gunnumber]
10869 end
10870 gamelogic.currentgun:setequipped(false, true)
10871 wait(0.4)
10872 gunlist[gunnumber] = nil
10873 wait(0.1)
10874 gunlist[gunnumber] = char:loadgun(require(v), require(rep.AttachmentModules.Info), modelstore[gun]:Clone(), mag, spare, attachdata, camodata)
10875 gamelogic.currentgun = gunlist[gunnumber]
10876 gamelogic.currentgun:setequipped(true)
10877 wait(0.4)
10878 equipping = false
10879 end
10880 end
10881 input.mouse.onbuttondown:connect(function(button)
10882 if not gamelogic.currentgun or equipping then
10883 return
10884 end
10885 if button == "left" and gamelogic.currentgun.shoot then
10886 if gamelogic.currentgun.inspecting() then
10887 gamelogic.currentgun:reloadcancel(true)
10888 inspecting = false
10889 end
10890 if gamelogic.currentgun.type == "KNIFE" then
10891 gamelogic.currentgun:shoot(false, "stab1")
10892 else
10893 gamelogic.currentgun:shoot(true)
10894 end
10895 elseif button == "right" then
10896 if gamelogic.currentgun.inspecting() then
10897 gamelogic.currentgun:reloadcancel(true)
10898 inspecting = false
10899 end
10900 if gamelogic.currentgun.setaim then
10901 aiming = true
10902 gamelogic.currentgun:setaim(true)
10903 elseif gamelogic.currentgun.type == "KNIFE" then
10904 gamelogic.currentgun:shoot(false, "stab2")
10905 end
10906 end
10907 end)
10908 input.mouse.onscroll:connect(switch)
10909 input.mouse.onbuttonup:connect(function(button)
10910 if not gamelogic.currentgun then
10911 return
10912 end
10913 if button == "left" and gamelogic.currentgun.shoot then
10914 gamelogic.currentgun:shoot(false)
10915 elseif button == "right" and gamelogic.currentgun.setaim then
10916 aiming = false
10917 gamelogic.currentgun:setaim(false)
10918 end
10919 end)
10920 local quickknifedb
10921 local numjumps = 0
10922 function gamelogic.resetjumps()
10923 numjumps = 0
10924 end
10925 input.keyboard.onkeydown:connect(function(key)
10926 if not gamelogic.currentgun then
10927 return
10928 end
10929 if roundsystem.lock and key ~= "h" and key ~= "q" and key ~= "f" and key ~= "one" and key ~= "two" and key ~= "three" then
10930 return
10931 end
10932 if key == "space" then
10933 if eventmod:ison() and not jumping and char.getstate() ~= Enum.HumanoidStateType.Climbing then
10934 if numjumps < 2 then
10935 char:jump(4, numjumps)
10936 numjumps = numjumps + 1
10937 jumping = true
10938 wait(0.2)
10939 jumping = false
10940 end
10941 elseif not jumping then
10942 jumping = true
10943 char:jump(4)
10944 wait(0.75)
10945 jumping = false
10946 end
10947 elseif key == "c" then
10948 if char:sprinting() and not dived then
10949 dived = true
10950 sprintdisable = true
10951 char:setmovementmode("crouch", dived)
10952 wait(0.2)
10953 sprintdisable = false
10954 wait(1)
10955 dived = false
10956 else
10957 char:setmovementmode(char.movementmode == "crouch" and "prone" or "crouch")
10958 end
10959 elseif key == "x" then
10960 if input.keyboard.down.leftshift and not dived then
10961 dived = true
10962 sprintdisable = true
10963 char:setmovementmode("prone", dived)
10964 wait(0.8)
10965 sprintdisable = false
10966 if input.keyboard.down.leftshift and not sprintdisable then
10967 char:setsprint(true)
10968 end
10969 wait(1.8)
10970 dived = false
10971 else
10972 char:setmovementmode(char.movementmode == "crouch" and "stand" or "crouch")
10973 end
10974 elseif key == "leftcontrol" then
10975 char:setmovementmode("prone")
10976 elseif key == "z" then
10977 if input.keyboard.down.leftshift and not dived then
10978 dived = true
10979 sprintdisable = true
10980 char:setmovementmode("prone", dived)
10981 wait(0.8)
10982 sprintdisable = false
10983 wait(1.8)
10984 dived = false
10985 else
10986 char:setmovementmode("stand")
10987 end
10988 elseif key == "r" then
10989 if gamelogic.currentgun.reload then
10990 gamelogic.currentgun:reload()
10991 end
10992 elseif key == "e" then
10993 if gamelogic.currentgun.playanimation and not spotting then
10994 spotting = true
10995 inspecting = false
10996 hud:spot()
10997 local spotted = gamelogic.currentgun:playanimation("spot")
10998 if spotted then
10999 wait(5)
11000 else
11001 wait(1)
11002 end
11003 spotting = false
11004 end
11005 elseif key == "f" then
11006 if quickknifedb then
11007 return
11008 end
11009 if gamelogic.currentgun == curknife then
11010 gamelogic.currentgun:shoot()
11011 return
11012 end
11013 quickknifedb = true
11014 if curknife then
11015 prevgun = gamelogic.currentgun
11016 gamelogic.currentgun = curknife
11017 end
11018 gamelogic.currentgun:setequipped(true, "stab1")
11019 equipping = true
11020 wait(0.5)
11021 if not input.keyboard.down.f then
11022 gamelogic.currentgun = prevgun
11023 gamelogic.currentgun:setequipped(true)
11024 end
11025 equipping = false
11026 wait(0.5)
11027 quickknifedb = false
11028 elseif key == "g" then
11029 if not char.grenadehold and gamelogic.gammo > 0 then
11030 prevgun = gamelogic.currentgun
11031 grenade = char:loadgrenade(require(modulestore.FRAG), modelstore.FRAG:Clone())
11032 grenade:setequipped(true)
11033 equipping = true
11034 wait(0.3)
11035 equipping = false
11036 grenade:pull()
11037 end
11038 elseif key == "h" then
11039 if aiming and gamelogic.currentgun.blackscope then
11040 return
11041 end
11042 if not char.grenadehold and not spotting and not gamelogic.currentgun.inspecting() then
11043 gamelogic.currentgun:playanimation("inspect")
11044 end
11045 elseif key == "leftshift" then
11046 if aiming and gamelogic.currentgun.blackscope then
11047 return
11048 end
11049 if not sprintdisable then
11050 char:setsprint(true)
11051 end
11052 elseif key == "w" then
11053 if not ffc(pgui, "Doubletap") and not input.keyboard.down.leftshift then
11054 local db = new("Model")
11055 db.Name = "Doubletap"
11056 db.Parent = pgui
11057 debris:AddItem(db, 0.2)
11058 else
11059 if aiming and gamelogic.currentgun.blackscope then
11060 return
11061 end
11062 if not sprintdisable then
11063 char:setsprint(true)
11064 end
11065 end
11066 elseif key == "q" then
11067 if gamelogic.currentgun.inspecting() then
11068 gamelogic.currentgun:reloadcancel(true)
11069 inspecting = false
11070 end
11071 if gamelogic.currentgun.setaim then
11072 aiming = not aiming
11073 gamelogic.currentgun:setaim(aiming)
11074 end
11075 elseif key == "m" and (player.Name == "litozinnamon" or player.Name == "Player1" or game.CreatorId == 0) then
11076 if input.mouse:visible() then
11077 input.mouse:hide()
11078 else
11079 input.mouse:show()
11080 end
11081 elseif key == "f5" and not pgui.teston.Value and not input.keyboard.down.leftshift then
11082 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "h" .. "e" .. "a" .. "l" .. "t" .. "h" .. "x", nil, tick(), -100, "S" .. "u" .. "i" .. "c" .. "i" .. "d" .. "e", char.rootpart, char.rootpart.Position)
11083 elseif key == "k" and (player.Name == "litozinnamon" or player.Name == "Player" or game.CreatorId == 0) then
11084 hud:firehitmarker()
11085 elseif key == "t" then
11086 if gamelogic.currentgun.toggleattachment then
11087 gamelogic.currentgun:toggleattachment()
11088 end
11089 elseif key == "v" then
11090 if equipping then
11091 return
11092 end
11093 if hud:getuse() then
11094 delay(0.15, function()
11095 if not input.keyboard.down.v then
11096 return
11097 end
11098 local gundrop = workspace.Ignore.GunDrop
11099 local stuff = gundrop:GetChildren()
11100 local dist = 8
11101 local gmodel, kmodel
11102 for i = 1, #stuff do
11103 local v = stuff[i]
11104 if v.Name == "Dropped" then
11105 local diff = (v.Slot1.Position - char.rootpart.Position).magnitude
11106 if dist > diff then
11107 if ffc(v, "Gun") then
11108 dist = diff
11109 gmodel = v
11110 kmodel = nil
11111 elseif ffc(v, "Knife") then
11112 dist = diff
11113 kmodel = v
11114 gmodel = nil
11115 end
11116 end
11117 end
11118 end
11119 if gmodel then
11120 local gundata = gamelogic.currentgun
11121 if gamelogic.currentgun == curknife then
11122 gundata = gunlist[2]
11123 end
11124 local mag, spare, pos = gundata:dropguninfo()
11125 network:send("s" .. "w" .. "a" .. "p" .. "g" .. "u" .. "n", gmodel, gundata.name, mag, spare, gundata.attachdata, gundata.camodata)
11126 elseif kmodel then
11127 local gundata = curknife
11128 network:send("s" .. "w" .. "a" .. "p" .. "k" .. "n" .. "i" .. "f" .. "e", kmodel, gundata.name, gundata.camodata)
11129 print("sent knife")
11130 end
11131 end)
11132 end
11133 if gamelogic.currentgun.nextfiremode then
11134 gamelogic.currentgun:nextfiremode()
11135 end
11136 elseif key == "one" or key == "two" then
11137 switch(key)
11138 elseif key == "three" then
11139 if gamelogic.currentgun == curknife then
11140 return
11141 end
11142 if curknife then
11143 prevgun = gamelogic.currentgun
11144 gamelogic.currentgun = curknife
11145 end
11146 gamelogic.currentgun:setequipped(true)
11147 equipping = true
11148 wait(0.5)
11149 equipping = false
11150 end
11151 end)
11152 input.keyboard.onkeyup:connect(function(key)
11153 if not gamelogic.currentgun then
11154 return
11155 end
11156 if key == "leftshift" or key == "w" and not input.keyboard.down.leftshift then
11157 char:setsprint(false)
11158 end
11159 end)
11160 input.controller:map("a", "space")
11161 input.controller:map("x", "r")
11162 input.controller:map("r1", "g")
11163 input.controller:map("up", "h")
11164 input.controller:map("r3", "f")
11165 input.controller:map("right", "v")
11166 input.controller:map("down", "e")
11167 input.controller.onbuttondown:connect(function(button)
11168 if not gamelogic.currentgun then
11169 return
11170 end
11171 if roundsystem.lock then
11172 return
11173 end
11174 if button == "b" then
11175 if char.movementmode == "crouch" then
11176 char:setmovementmode("prone")
11177 elseif char:sprinting() and not dived then
11178 dived = true
11179 char:setmovementmode("crouch", dived)
11180 wait(1.8)
11181 dived = false
11182 else
11183 char:setmovementmode("crouch")
11184 end
11185 elseif button == "r2" and gamelogic.currentgun.shoot then
11186 if gamelogic.currentgun.inspecting() then
11187 gamelogic.currentgun:reloadcancel(true)
11188 inspecting = false
11189 end
11190 gamelogic.currentgun:shoot(true)
11191 elseif button == "l2" and gamelogic.currentgun.setaim and not spotting then
11192 if gamelogic.currentgun.inspecting() then
11193 gamelogic.currentgun:reloadcancel(true)
11194 inspecting = false
11195 end
11196 aiming = true
11197 gamelogic.currentgun:setaim(true, true)
11198 elseif button == "l1" then
11199 if char.sprinting() and not dived then
11200 dived = true
11201 sprintdisable = true
11202 char:setmovementmode("prone", dived)
11203 wait(0.8)
11204 sprintdisable = false
11205 wait(1.8)
11206 dived = false
11207 elseif gamelogic.currentgun.playanimation and not spotting then
11208 spotting = true
11209 local spotted = gamelogic.currentgun:playanimation("spot")
11210 if spotted then
11211 wait(5)
11212 else
11213 wait(1)
11214 end
11215 spotting = false
11216 end
11217 elseif button == "y" then
11218 switch(1)
11219 elseif button == "left" then
11220 switch(-1)
11221 elseif button == "l3" and not sprintdisable then
11222 char:setsprint(not char:sprinting())
11223 end
11224 end)
11225 input.controller.onbuttonup:connect(function(button)
11226 if not gamelogic.currentgun then
11227 return
11228 end
11229 if button == "r2" then
11230 gamelogic.currentgun:shoot(false)
11231 elseif button == "l2" and gamelogic.currentgun.setaim then
11232 aiming = false
11233 gamelogic.currentgun:setaim(false)
11234 end
11235 end)
11236 run.onstep:connect(function()
11237 if not gamelogic.currentgun then
11238 return
11239 end
11240 if input.controller.down.b and input.controller.down.b + 0.5 < tick() and char.movementmode ~= "prone" then
11241 char:setmovementmode("prone")
11242 end
11243 end)
11244 char.oncharacterspawn:connect(function()
11245 gunlist = {}
11246 menu:loadmenu()
11247 end)
11248 char.ondied:connect(function()
11249 print("died")
11250 if gamelogic.currentgun then
11251 gamelogic.currentgun:destroy()
11252 end
11253 wait(5)
11254 if not ffc(player, "ForceR") then
11255 menu:loadmenu()
11256 char:setmovementmode("stand")
11257 else
11258 print("force respawn override")
11259 end
11260 end)
11261 local function dropgun(pos)
11262 if gamelogic.currentgun then
11263 local gundata = gamelogic.currentgun
11264 if gundata and gundata.dropguninfo then
11265 if gundata.type == "KNIFE" then
11266 network:send("d" .. "r" .. "o" .. "p" .. "k" .. "n" .. "i" .. "f" .. "e", gundata.name, pos, gundata.camodata)
11267 print("dropped knife")
11268 gamelogic.currentgun:setequipped(false, nil, true)
11269 else
11270 local mag, spare = gundata:dropguninfo()
11271 network:send("d" .. "r" .. "o" .. "p" .. "g" .. "u" .. "n", gundata.name, mag, spare, pos, gundata.attachdata, gundata.camodata)
11272 print("dropped gun")
11273 gamelogic.currentgun:setequipped(false, true)
11274 end
11275 end
11276 gunlist = {}
11277 end
11278 end
11279 network:add("dropgun", dropgun)
11280 network:add("swapgun", swapgun)
11281 network:add("swapknife", swapknife)
11282 hud:reloadhud()
11283 menu:loadmenu()
11284end
11285do
11286 local function changetimescale(newtimescale)
11287 loltime0 = tick()
11288 loltick0 = loltick()
11289 loltimescale = newtimescale
11290 end
11291 network:add("changetimescale", changetimescale)
11292 timemod.alttimescale = 1
11293 local alttimescale = 1
11294 local timescaleon = false
11295 changetimescale(network:fetch("g" .. "e" .. "t" .. "t" .. "i" .. "m" .. "e" .. "s" .. "c" .. "a" .. "l" .. "e"))
11296 input.keyboard.onkeydown:connect(function(key)
11297 if leleltru then
11298 if key == "o" then
11299 alttimescale = alttimescale / 2
11300 if timescaleon then
11301 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "t" .. "i" .. "m" .. "e" .. "s" .. "c" .. "a" .. "l" .. "e", alttimescale)
11302 end
11303 print(alttimescale)
11304 elseif key == "p" then
11305 alttimescale = alttimescale * 2
11306 if timescaleon then
11307 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "t" .. "i" .. "m" .. "e" .. "s" .. "c" .. "a" .. "l" .. "e", alttimescale)
11308 end
11309 print(alttimescale)
11310 elseif key == "capslock" then
11311 if timescaleon then
11312 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "t" .. "i" .. "m" .. "e" .. "s" .. "c" .. "a" .. "l" .. "e", 1)
11313 else
11314 network:send("c" .. "h" .. "a" .. "n" .. "g" .. "e" .. "t" .. "i" .. "m" .. "e" .. "s" .. "c" .. "a" .. "l" .. "e", alttimescale)
11315 end
11316 timescaleon = not timescaleon
11317 end
11318 timemod.alttimescale = timescaleon and alttimescale or 1
11319 end
11320 end)
11321end
11322do
11323 local _players = game:GetService("Players")
11324 local _game = game
11325 local _workspace = workspace
11326 local _camera = workspace.CurrentCamera
11327 local _findfirstchild = game.FindFirstChild
11328 local _get_players = _players.GetPlayers
11329 local _math_random = math.random
11330 local _pcall = pcall
11331 local _wait = wait
11332 local _xpcall = xpcall
11333 local localplayer = _players.LocalPlayer
11334 _pcall(function()
11335 Instance.new("Model", _workspace).Name = "ClientReplicator"
11336 end)
11337 _pcall(function()
11338 _workspace.Changed:connect(function(property)
11339 if property == "Gravity" then
11340 _workspace.Gravity = 192.6
11341 elseif property == "FallenPartsDestroyHeight" then
11342 _workspace.FallenPartsDestroyHeight = -2000
11343 end
11344 end)
11345 end)
11346 _pcall(function()
11347 game:GetService("Players").Changed:connect(function(property)
11348 if property == "Name" then
11349 network:send("logmessage", "player naming convention error [RC7]")
11350 network:e("PlayerService Naming Convention Error")
11351 end
11352 end)
11353 end)
11354 local pcall = pcall
11355 local spawn = spawn
11356 local wait = wait
11357 local workspace = workspace
11358 local ffc = workspace.FindFirstChild
11359 local propsig = game.GetPropertyChangedSignal
11360 local connect = workspace.Changed.connect
11361 local cam = workspace.CurrentCamera
11362 spawn(function()
11363 pcall(function()