· 5 years ago · Feb 07, 2020, 02:34 PM
1
2--Converted with ttyyuu12345's model to script plugin v4
3IntValue38.Name = "ignoreCode"
4IntValue38.Parent = LocalScript37
5Folder39.Name = "Server_Scripts"
6Folder39.Parent = LocalScript37
7ModuleScript40.Name = "Spring"
8ModuleScript40.Parent = LocalScript37
9table.insert(cors,sandbox(ModuleScript40,function()
10local Spring = {}
11
12function Spring.new(Initial)
13 local t0 = tick()
14 local p0 = Initial or 0
15 local v0 = Initial and Vector3.new() or 0
16 local t = Initial or 0
17 local d = 1
18 local s = 1
19
20 local function positionVelocity(Tick)
21 local x = Tick - t0
22 local c0 = p0 - t
23 if s == 0 then
24 return p0, 0
25 elseif d < 1 then
26 local c = math.sqrt(1 - d ^ 2)
27 local c1 = (v0 / s + d * c0) / c
28 local co = math.cos(c * s * x)
29 local si = math.sin(c * s * x)
30 local e = math.exp(d * s * x)
31 local p = t + (c0 * co + c1 * si) / e
32 local v = s * ((c * c1 - d * c0) * co - (c * c0 + d * c1) * si) / e
33 return p, v
34 else
35 local c1 = v0 / s + c0
36 local e = math.exp(s * x)
37 local p = t + (c0 + c1 * s * x) / e
38 local v = s * (c1 - c0 - c1 * s * x) / e
39 return p, v
40 end
41 end
42
43 return setmetatable(
44 {
45 accelerate = function(_, acceleration)
46 local T = tick()
47 local p, v = positionVelocity(T)
48 p0 = p
49 v0 = v + acceleration
50 t0 = T
51 end;
52 },
53 {
54 __index = function(_, index)
55 if index == "value" or index == "position" or index == "p" then
56 local p, v = positionVelocity(tick())
57 return p
58 elseif index == "velocity" or index == "v" then
59 local p, v = positionVelocity(tick())
60 return v
61 elseif index == "acceleration" or index == "a" then
62 local x = tick() - t0
63 local c0 = p0 - t
64 if s == 0 then
65 return 0
66 elseif d < 1 then
67 local c = math.sqrt(1 - d ^ 2)
68 local c1 = (v0 / s + d * c0) / c
69 local cs = (c0 * d ^ 2 - 2 * c * d * c1 - c0 * c ^ 2) * math.cos(c * s * x)
70 local sn = (c1 * d ^ 2 + 2 * c * d * c0 - c1 * c ^ 2) * math.sin(c * s * x)
71 return s ^ 2 *(cs + sn) / math.exp(d * s * x)
72 else
73 local c1 = v0 / s + c0
74 return s ^ 2 * (c0 - 2 * c1 + c1 * s * x) / math.exp(s * x)
75 end
76 elseif index == "target" or index == "t" then
77 return t
78 elseif index == "damper" or index == "d" then
79 return d
80 elseif index == "speed" or index == "s" then
81 return s
82 elseif index == "magnitude" or index == "m" then
83 local p, v = positionVelocity(tick())
84 return p.magnitude
85 else
86 error(index.." is not a valid member of spring", 0)
87 end
88 end;
89
90 __newindex = function(_, index, value)
91 local T = tick()
92 if index == "value" or index == "position" or index == "p" then
93 local p, v = positionVelocity(T)
94 p0, v0 = value, v
95 elseif index == "velocity" or index == "v" then
96 local p, v = positionVelocity(T)
97 p0, v0 = p, value
98 elseif index == "acceleration" or index == "a" then
99 local p, v = positionVelocity(T)
100 p0, v0 = p, v + value
101 elseif index == "target" or index == "t" then
102 p0, v0 = positionVelocity(T)
103 t = value
104 elseif index == "damper" or index == "d" then
105 p0, v0 = positionVelocity(T)
106 d = value < 0 and 0 or value < 1 and value or 1
107 elseif index == "speed" or index == "s" then
108 p0, v0 = positionVelocity(T)
109 s = value < 0 and 0 or value
110 else
111 error(index.." is not a valid member of spring", 0)
112 end
113 t0 = T
114 end;
115 }
116 )
117end
118
119return Spring
120end))
121ModuleScript41.Name = "Particle"
122ModuleScript41.Parent = LocalScript37
123table.insert(cors,sandbox(ModuleScript41,function()
124---------------------------------------------------------------------------------------------------------
125--[[
126
127 AUTHOR: TurboFusion
128 DATE CREATED: 4/8/16
129
130 DESCRIPTION: This is a module that creates gui particles which simulates physical parts
131
132 function Particle.new(Prop)
133
134 ARGUMENT: Table {
135 Table rayIgnore; --This table contains objects that the visiblity checking ray should ignore (DEFAULT: {})
136 Color3 Color; --This color3 value is what color the particle will be (DEFAULT: Color3.new(1, 1, 1))
137 float Length; --This float value is how long the particle will be in world space (DEFAULT: 1)
138 float Width; --This float value is how wide the particle will be in world space (DEFAULT: 1)
139 Vector3 p0; --This Vector3 value is the initial position of the particle (Must exist)
140 Vector3 v0; --This Vector3 value is the initial velocity of the particle (Must exist)
141 Vector3 a0; --This Vector3 value is the initial acceleration of the particle (Must exist)
142 }
143
144 RETURNS: Metatable
145
146 EDITABLE PROPERTIES:
147 Particle.t = float Time --Sets a time value in seconds which is used to figure out where to render the particle (t=0 will be initial conditions)
148
149 READ-ONLY PROPERTIES:
150 Particle.p or Particle.position --Returns a world position of the particle
151 Particle.v or Particle.velocity --Returns a world velocity of the particle
152 Particle.obj or Particle.object --Returns the particle frame itself
153
154 METHODS:
155 Particle:delete() --This method deletes the particle and stops rendering calculations (use this instead of directly destroying the frame itself)
156
157 EXAMPLE CODE:
158 local t = 0
159 local Particle = Particle.new(
160 {
161 Color = Color3.new(1, 1, 0);
162 Width = 1;
163 p0 = Vector3.new();
164 v0 = Vector3.new(0, 100, 100);
165 a0 = Vector3.new(0, -196.2, 0);
166 }
167 )
168 Particle.obj.Parent = screenGui
169 while true do
170 Particle.t = t
171 t = t + 1/30
172 wait()
173 end
174
175--]]
176---------------------------------------------------------------------------------------------------------
177
178local Particle = {}
179
180function Particle.new(Prop)
181 ----------[ CONSTANTS ]--------------------
182
183 local Cam = workspace.CurrentCamera
184 local rayIgnore = Prop.rayIgnore or {} --If the property doesn't exist, then set it to it's default
185 local Color = Prop.Color or Color3.new(1, 1, 1)
186 local Length = Prop.Length or 1
187 local Width = Prop.Width or 1
188 local p0 = Prop.p0 or error("Particle.new requires a p0 (origin position) property!", 0) --Give an error message if you don't this
189 local v0 = Prop.v0 or error("Particle.new requires a v0 (initial velocity) property!", 0)
190 local a0 = Prop.a0 or error("Particle.new requires an a0 (initial acceleration) property!", 0)
191
192 ----------[ VARIABLES ]--------------------
193
194 local Deleted = false
195 local p = p0 --Set the position, velocity, and acceleration as the intial conditions
196 local v = v0
197 local a = a0
198 local t = 0
199
200 ----------[ FUNCTIONS ]--------------------
201
202 local function worldWidthToScreenWidth(Width, Depth) --A function I made that gives you a screen width given a world width and depth
203 local Center = Cam.CoordinateFrame * CFrame.new(0, 0, -Depth)
204 local wp1 = (Center * CFrame.new(0, Width / 2, 0)).p
205 local wp2 = (Center * CFrame.new(0, -Width / 2, 0)).p
206 local sp1 = Cam:WorldToScreenPoint(wp1) --Use the WorldToScreenPoint method of the camera to get the screen width from the world width
207 local sp2 = Cam:WorldToScreenPoint(wp2)
208 return (sp1 - sp2).magnitude
209 end
210
211 ----------[ MAIN PROGRAM ]-----------------
212
213 local Container = Instance.new("Frame")
214 Container.BackgroundTransparency = 1
215 Container.Position = UDim2.new()
216 Container.Size = UDim2.new()
217 local Line = Instance.new("Frame")
218 Line.BackgroundColor3 = Color
219 Line.BorderSizePixel = 0
220 Line.Position = UDim2.new()
221 Line.Size = UDim2.new()
222 Line.Parent = Container
223
224 return setmetatable(
225 {
226 delete = function() --This function safely removes the particle
227 Container:Destroy()
228 Deleted = true
229 end
230 },
231 {
232 __index = function(_, Index)
233 if Index == "p" or Index == "position" then --Return the world position of the particle
234 return (Deleted and nil or p)
235 elseif Index == "v" or Index == "velocity" then --Return the world velocity of the particle
236 return (Deleted and nil or v)
237 elseif Index == "obj" or Index == "object" then --Return the particle frame itself
238 return (Deleted and nil or Container)
239 else
240 error(Index.." is not a member of Particle!", 0) --Give an error message if any other index is called
241 end
242 end;
243
244 __newindex = function(_, Index, Value)
245 if Index == "t" or Index == "time" and (not Deleted) then --Render the particle given a time value
246 t = Value
247 p = p0 + (v0 * t) + (0.5 * a0 * t * t) --update the position given the time
248 v = v0 + (a0 * t) --update the velocity given the time
249
250 local testRay1 = Ray.new(Cam.CoordinateFrame.p, (p + (v.unit * Length) / 2) - Cam.CoordinateFrame.p)
251 local testRay2 = Ray.new(Cam.CoordinateFrame.p, (p - (v.unit * Length) / 2) - Cam.CoordinateFrame.p)
252 local H1, _ = workspace:FindPartOnRayWithIgnoreList(testRay1, rayIgnore)
253 local H2, _ = workspace:FindPartOnRayWithIgnoreList(testRay2, rayIgnore)
254
255 if H1 and H2 then
256 Line.Visible = false
257 else
258 local face1 = Cam:WorldToScreenPoint(p + (v.unit * Length) / 2) --Get the 2 endpoints of the particle in screen space
259 local face2 = Cam:WorldToScreenPoint(p - (v.unit * Length) / 2)
260 local Center, isVisible = Cam:WorldToScreenPoint(p) --Get the center of the particle in screen space
261
262 local screenLength = (face1 - face2).magnitude
263 local screenWidth = worldWidthToScreenWidth(Width, Center.Z)
264 local Ang = math.atan2(face1.Y - face2.Y, face1.X - face2.X) --Get the angle the particle needs to be at in order to line up
265
266 Line.Position = UDim2.new(0, 0, 0, -screenWidth / 2)
267 Line.Size = UDim2.new(1, 0, 0, screenWidth)
268 Line.Visible = isVisible --Make the particle invisible if the world point isn't on screen
269
270 Container.Position = UDim2.new(
271 0,
272 face2.X + (math.cos(Ang) - 1) * screenLength / 2, --Yay trig!
273 0,
274 face2.Y + math.sin(Ang) * screenLength / 2
275 )
276 Container.Size = UDim2.new(0, screenLength, 0, 0)
277 Container.Rotation = math.deg(Ang)
278 end
279 else
280 error(Index.." is not a member of Particle!", 0) --Give an error message if any other index is being changed
281 end
282 end
283 }
284 )
285end
286
287return Particle
288end))
289ScreenGui42.Name = "mainGUI"
290ScreenGui42.Parent = LocalScript37
291ImageLabel43.Name = "hitMarker"
292ImageLabel43.Parent = ScreenGui42
293ImageLabel43.Position = UDim2.new(0.5, -13, 0.5, -31)
294ImageLabel43.Visible = false
295ImageLabel43.Size = UDim2.new(0, 26, 0, 26)
296ImageLabel43.BackgroundTransparency = 1
297ImageLabel43.ZIndex = 10
298ImageLabel43.Image = "http://www.roblox.com/asset/?id=121173757"
299NumberValue44.Name = "lastMark"
300NumberValue44.Parent = ImageLabel43
301Frame45.Name = "crossHair"
302Frame45.Parent = ScreenGui42
303Frame45.Position = UDim2.new(0.5, 0, 0.5, -18)
304Frame45.BackgroundColor = BrickColor.new("Institutional white")
305Frame45.BackgroundColor3 = Color3.new(1, 1, 1)
306Frame45.BorderColor = BrickColor.new("Really black")
307Frame45.BorderColor3 = Color3.new(0, 0, 0)
308Frame45.BorderSizePixel = 0
309ImageLabel46.Parent = Frame45
310ImageLabel46.Position = UDim2.new(0, -150, 0, -150)
311ImageLabel46.Visible = false
312ImageLabel46.Size = UDim2.new(0, 300, 0, 300)
313ImageLabel46.BackgroundColor = BrickColor.new("Institutional white")
314ImageLabel46.BackgroundColor3 = Color3.new(1, 1, 1)
315ImageLabel46.BackgroundTransparency = 1
316ImageLabel46.ZIndex = 2
317ImageLabel46.Image = "http://www.roblox.com/asset/?id=68308747"
318TextLabel47.Name = "Reload"
319TextLabel47.Parent = Frame45
320TextLabel47.Position = UDim2.new(0, -50, 0, 70)
321TextLabel47.Visible = false
322TextLabel47.Size = UDim2.new(0, 100, 0, 20)
323TextLabel47.BackgroundColor = BrickColor.new("Institutional white")
324TextLabel47.BackgroundColor3 = Color3.new(1, 1, 1)
325TextLabel47.BackgroundTransparency = 1
326TextLabel47.ZIndex = 2
327TextLabel47.Font = Enum.Font.SourceSansBold
328TextLabel47.FontSize = Enum.FontSize.Size18
329TextLabel47.Text = "RELOADING..."
330TextLabel47.TextColor = BrickColor.new("Institutional white")
331TextLabel47.TextColor3 = Color3.new(1, 1, 1)
332TextLabel47.TextSize = 18
333TextLabel47.TextStrokeTransparency = 0.5
334Frame48.Name = "C"
335Frame48.Parent = Frame45
336Frame48.Position = UDim2.new(0, -2, 0, 0)
337Frame48.Size = UDim2.new(0, 4, 0, 500)
338Frame48.BackgroundColor = BrickColor.new("Institutional white")
339Frame48.BackgroundColor3 = Color3.new(1, 1, 1)
340Frame48.BackgroundTransparency = 1
341Frame48.ClipsDescendants = true
342TextLabel49.Name = "Line"
343TextLabel49.Parent = Frame48
344TextLabel49.Position = UDim2.new(0.5, -1, 0, 10)
345TextLabel49.Size = UDim2.new(0, 2, 0, 15)
346TextLabel49.BackgroundColor = BrickColor.new("Institutional white")
347TextLabel49.BackgroundColor3 = Color3.new(1, 1, 1)
348TextLabel49.BorderColor = BrickColor.new("Dark stone grey")
349TextLabel49.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
350TextLabel49.Font = Enum.Font.SourceSans
351TextLabel49.FontSize = Enum.FontSize.Size14
352TextLabel49.Text = ""
353TextLabel49.TextSize = 14
354Frame50.Name = "A"
355Frame50.Parent = Frame45
356Frame50.Position = UDim2.new(0, -2, 0, -500)
357Frame50.Size = UDim2.new(0, 4, 0, 500)
358Frame50.BackgroundColor = BrickColor.new("Institutional white")
359Frame50.BackgroundColor3 = Color3.new(1, 1, 1)
360Frame50.BackgroundTransparency = 1
361Frame50.ClipsDescendants = true
362TextLabel51.Name = "Line"
363TextLabel51.Parent = Frame50
364TextLabel51.Position = UDim2.new(0.5, -1, 1, -25)
365TextLabel51.Size = UDim2.new(0, 2, 0, 15)
366TextLabel51.BackgroundColor = BrickColor.new("Institutional white")
367TextLabel51.BackgroundColor3 = Color3.new(1, 1, 1)
368TextLabel51.BorderColor = BrickColor.new("Dark stone grey")
369TextLabel51.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
370TextLabel51.Font = Enum.Font.SourceSans
371TextLabel51.FontSize = Enum.FontSize.Size14
372TextLabel51.Text = ""
373TextLabel51.TextSize = 14
374Frame52.Name = "B"
375Frame52.Parent = Frame45
376Frame52.Position = UDim2.new(0, 0, 0, -2)
377Frame52.Size = UDim2.new(0, 500, 0, 4)
378Frame52.BackgroundColor = BrickColor.new("Institutional white")
379Frame52.BackgroundColor3 = Color3.new(1, 1, 1)
380Frame52.BackgroundTransparency = 1
381Frame52.ClipsDescendants = true
382TextLabel53.Name = "Line"
383TextLabel53.Parent = Frame52
384TextLabel53.Position = UDim2.new(0, 10, 0.5, -1)
385TextLabel53.Size = UDim2.new(0, 15, 0, 2)
386TextLabel53.BackgroundColor = BrickColor.new("Institutional white")
387TextLabel53.BackgroundColor3 = Color3.new(1, 1, 1)
388TextLabel53.BorderColor = BrickColor.new("Dark stone grey")
389TextLabel53.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
390TextLabel53.Font = Enum.Font.SourceSans
391TextLabel53.FontSize = Enum.FontSize.Size14
392TextLabel53.Text = ""
393TextLabel53.TextSize = 14
394Frame54.Name = "D"
395Frame54.Parent = Frame45
396Frame54.Position = UDim2.new(0, -500, 0, -2)
397Frame54.Size = UDim2.new(0, 500, 0, 4)
398Frame54.BackgroundColor = BrickColor.new("Institutional white")
399Frame54.BackgroundColor3 = Color3.new(1, 1, 1)
400Frame54.BackgroundTransparency = 1
401Frame54.ClipsDescendants = true
402TextLabel55.Name = "Line"
403TextLabel55.Parent = Frame54
404TextLabel55.Position = UDim2.new(1, -25, 0.5, -1)
405TextLabel55.Size = UDim2.new(0, 15, 0, 2)
406TextLabel55.BackgroundColor = BrickColor.new("Institutional white")
407TextLabel55.BackgroundColor3 = Color3.new(1, 1, 1)
408TextLabel55.BorderColor = BrickColor.new("Dark stone grey")
409TextLabel55.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
410TextLabel55.Font = Enum.Font.SourceSans
411TextLabel55.FontSize = Enum.FontSize.Size14
412TextLabel55.Text = ""
413TextLabel55.TextSize = 14
414Frame56.Name = "HUD"
415Frame56.Parent = ScreenGui42
416Frame56.Position = UDim2.new(1, -199, 1, -164)
417Frame56.Size = UDim2.new(0, 175, 0, 99)
418Frame56.BackgroundColor = BrickColor.new("Black")
419Frame56.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
420Frame56.BackgroundTransparency = 0.30000001192093
421Frame56.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
422Frame56.BorderSizePixel = 5
423Frame56.Draggable = true
424Frame56.ZIndex = 10
425Frame57.Name = "Ammo"
426Frame57.Parent = Frame56
427Frame57.Position = UDim2.new(0, 0, 0, 45)
428Frame57.Size = UDim2.new(0, 175, 0, 40)
429Frame57.BackgroundTransparency = 1
430Frame57.ZIndex = 10
431TextLabel58.Name = "Slash"
432TextLabel58.Parent = Frame57
433TextLabel58.Position = UDim2.new(0, 90, 0, 0)
434TextLabel58.Size = UDim2.new(0, 10, 0, 25)
435TextLabel58.BackgroundTransparency = 1
436TextLabel58.ZIndex = 10
437TextLabel58.Font = Enum.Font.ArialBold
438TextLabel58.FontSize = Enum.FontSize.Size24
439TextLabel58.Text = "/"
440TextLabel58.TextColor = BrickColor.new("Institutional white")
441TextLabel58.TextColor3 = Color3.new(1, 1, 1)
442TextLabel58.TextSize = 24
443TextLabel59.Name = "Stored"
444TextLabel59.Parent = Frame57
445TextLabel59.Position = UDim2.new(0, 105, 0, 0)
446TextLabel59.Size = UDim2.new(0, 70, 0, 25)
447TextLabel59.BackgroundTransparency = 1
448TextLabel59.ZIndex = 10
449TextLabel59.Font = Enum.Font.ArialBold
450TextLabel59.FontSize = Enum.FontSize.Size24
451TextLabel59.Text = "100"
452TextLabel59.TextColor = BrickColor.new("Institutional white")
453TextLabel59.TextColor3 = Color3.new(1, 1, 1)
454TextLabel59.TextSize = 24
455TextLabel59.TextXAlignment = Enum.TextXAlignment.Left
456TextLabel60.Name = "Background"
457TextLabel60.Parent = TextLabel59
458TextLabel60.Size = UDim2.new(1, 0, 1, 0)
459TextLabel60.BackgroundTransparency = 1
460TextLabel60.ZIndex = 10
461TextLabel60.Font = Enum.Font.ArialBold
462TextLabel60.FontSize = Enum.FontSize.Size24
463TextLabel60.Text = "000"
464TextLabel60.TextColor = BrickColor.new("Sand violet metallic")
465TextLabel60.TextColor3 = Color3.new(0.588235, 0.588235, 0.588235)
466TextLabel60.TextSize = 24
467TextLabel60.TextTransparency = 0.80000001192093
468TextLabel60.TextWrap = true
469TextLabel60.TextWrapped = true
470TextLabel60.TextXAlignment = Enum.TextXAlignment.Left
471TextLabel61.Name = "Clip"
472TextLabel61.Parent = Frame57
473TextLabel61.Size = UDim2.new(0, 85, 1, 0)
474TextLabel61.BackgroundTransparency = 1
475TextLabel61.ZIndex = 10
476TextLabel61.Font = Enum.Font.ArialBold
477TextLabel61.FontSize = Enum.FontSize.Size48
478TextLabel61.Text = "9"
479TextLabel61.TextColor = BrickColor.new("Institutional white")
480TextLabel61.TextColor3 = Color3.new(1, 1, 1)
481TextLabel61.TextSize = 48
482TextLabel61.TextXAlignment = Enum.TextXAlignment.Right
483TextLabel62.Name = "Background"
484TextLabel62.Parent = TextLabel61
485TextLabel62.Size = UDim2.new(1, 0, 1, 0)
486TextLabel62.BackgroundTransparency = 1
487TextLabel62.ZIndex = 10
488TextLabel62.Font = Enum.Font.ArialBold
489TextLabel62.FontSize = Enum.FontSize.Size48
490TextLabel62.Text = "000"
491TextLabel62.TextColor = BrickColor.new("Sand violet metallic")
492TextLabel62.TextColor3 = Color3.new(0.588235, 0.588235, 0.588235)
493TextLabel62.TextSize = 48
494TextLabel62.TextTransparency = 0.80000001192093
495TextLabel62.TextXAlignment = Enum.TextXAlignment.Right
496Frame63.Name = "Mode"
497Frame63.Parent = Frame56
498Frame63.Position = UDim2.new(0, 90, 0, 65)
499Frame63.Size = UDim2.new(0, 85, 0, 20)
500Frame63.BackgroundColor = BrickColor.new("Institutional white")
501Frame63.BackgroundColor3 = Color3.new(1, 1, 1)
502Frame63.BackgroundTransparency = 1
503Frame63.ZIndex = 10
504TextLabel64.Name = "Bracket"
505TextLabel64.Parent = Frame63
506TextLabel64.Size = UDim2.new(0, 5, 0, 20)
507TextLabel64.BackgroundTransparency = 1
508TextLabel64.ZIndex = 10
509TextLabel64.Font = Enum.Font.ArialBold
510TextLabel64.FontSize = Enum.FontSize.Size18
511TextLabel64.Text = "["
512TextLabel64.TextColor = BrickColor.new("Institutional white")
513TextLabel64.TextColor3 = Color3.new(1, 1, 1)
514TextLabel64.TextSize = 18
515TextLabel64.TextXAlignment = Enum.TextXAlignment.Left
516TextLabel65.Name = "Bracket"
517TextLabel65.Parent = Frame63
518TextLabel65.Position = UDim2.new(1, -5, 0, 0)
519TextLabel65.Size = UDim2.new(0, 5, 0, 20)
520TextLabel65.BackgroundTransparency = 1
521TextLabel65.ZIndex = 10
522TextLabel65.Font = Enum.Font.ArialBold
523TextLabel65.FontSize = Enum.FontSize.Size18
524TextLabel65.Text = "]"
525TextLabel65.TextColor = BrickColor.new("Institutional white")
526TextLabel65.TextColor3 = Color3.new(1, 1, 1)
527TextLabel65.TextSize = 18
528TextLabel65.TextXAlignment = Enum.TextXAlignment.Left
529TextLabel66.Name = "Main"
530TextLabel66.Parent = Frame63
531TextLabel66.Size = UDim2.new(1, 0, 0, 20)
532TextLabel66.BackgroundTransparency = 1
533TextLabel66.ZIndex = 10
534TextLabel66.Font = Enum.Font.SourceSansBold
535TextLabel66.FontSize = Enum.FontSize.Size18
536TextLabel66.Text = "Auto"
537TextLabel66.TextColor = BrickColor.new("Institutional white")
538TextLabel66.TextColor3 = Color3.new(1, 1, 1)
539TextLabel66.TextSize = 18
540TextLabel66.TextWrap = true
541TextLabel66.TextWrapped = true
542Frame67.Name = "Health"
543Frame67.Parent = Frame56
544Frame67.Position = UDim2.new(0, 0, 0, -40)
545Frame67.Size = UDim2.new(1, 0, 0, 25)
546Frame67.BackgroundColor = BrickColor.new("Black")
547Frame67.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
548Frame67.BackgroundTransparency = 0.30000001192093
549Frame67.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
550Frame67.BorderSizePixel = 5
551Frame67.ZIndex = 10
552TextLabel68.Name = "Num"
553TextLabel68.Parent = Frame67
554TextLabel68.Position = UDim2.new(1, -50, 0, 0)
555TextLabel68.Size = UDim2.new(0, 50, 1, 0)
556TextLabel68.BackgroundColor = BrickColor.new("Really black")
557TextLabel68.BackgroundColor3 = Color3.new(0, 0, 0)
558TextLabel68.BackgroundTransparency = 1
559TextLabel68.BorderColor = BrickColor.new("Really black")
560TextLabel68.BorderColor3 = Color3.new(0, 0, 0)
561TextLabel68.BorderSizePixel = 0
562TextLabel68.ZIndex = 10
563TextLabel68.Font = Enum.Font.ArialBold
564TextLabel68.FontSize = Enum.FontSize.Size24
565TextLabel68.Text = "100%"
566TextLabel68.TextColor = BrickColor.new("Institutional white")
567TextLabel68.TextColor3 = Color3.new(1, 1, 1)
568TextLabel68.TextSize = 24
569TextLabel68.TextStrokeTransparency = 0
570TextLabel68.TextXAlignment = Enum.TextXAlignment.Right
571Frame69.Name = "Tray"
572Frame69.Parent = Frame67
573Frame69.Position = UDim2.new(0, 2, 0.5, -10)
574Frame69.Size = UDim2.new(1, -60, 0, 20)
575Frame69.BackgroundColor = BrickColor.new("Really black")
576Frame69.BackgroundColor3 = Color3.new(0, 0, 0)
577Frame69.BackgroundTransparency = 1
578Frame69.BorderColor = BrickColor.new("Really black")
579Frame69.BorderColor3 = Color3.new(0, 0, 0)
580Frame69.BorderSizePixel = 0
581Frame69.ClipsDescendants = true
582Frame69.ZIndex = 10
583Frame70.Name = "Beat"
584Frame70.Parent = Frame69
585Frame70.Position = UDim2.new(1, 0, 0, 0)
586Frame70.Size = UDim2.new(0, 21, 1, 0)
587Frame70.BackgroundColor = BrickColor.new("Really black")
588Frame70.BackgroundColor3 = Color3.new(0, 0, 0)
589Frame70.BackgroundTransparency = 1
590Frame70.BorderColor = BrickColor.new("Really black")
591Frame70.BorderColor3 = Color3.new(0, 0, 0)
592Frame70.BorderSizePixel = 0
593Frame70.ZIndex = 10
594Frame71.Name = "00"
595Frame71.Parent = Frame70
596Frame71.Position = UDim2.new(0, 0, 0.5, -2)
597Frame71.Size = UDim2.new(0.0476190485, 0, 0, 3)
598Frame71.BackgroundColor = BrickColor.new("Institutional white")
599Frame71.BackgroundColor3 = Color3.new(1, 1, 1)
600Frame71.BorderColor = BrickColor.new("Really black")
601Frame71.BorderColor3 = Color3.new(0, 0, 0)
602Frame71.BorderSizePixel = 0
603Frame71.ZIndex = 10
604Frame72.Name = "01"
605Frame72.Parent = Frame70
606Frame72.Position = UDim2.new(0.0476190485, 0, 0.423076928, -2)
607Frame72.Size = UDim2.new(0.0476190485, 0, 0, 4)
608Frame72.BackgroundColor = BrickColor.new("Institutional white")
609Frame72.BackgroundColor3 = Color3.new(1, 1, 1)
610Frame72.BorderColor = BrickColor.new("Really black")
611Frame72.BorderColor3 = Color3.new(0, 0, 0)
612Frame72.BorderSizePixel = 0
613Frame72.ZIndex = 10
614Frame73.Name = "02"
615Frame73.Parent = Frame70
616Frame73.Position = UDim2.new(0.095238097, 0, 0.346153855, -2)
617Frame73.Size = UDim2.new(0.0476190485, 0, 0, 4)
618Frame73.BackgroundColor = BrickColor.new("Institutional white")
619Frame73.BackgroundColor3 = Color3.new(1, 1, 1)
620Frame73.BorderColor = BrickColor.new("Really black")
621Frame73.BorderColor3 = Color3.new(0, 0, 0)
622Frame73.BorderSizePixel = 0
623Frame73.ZIndex = 10
624Frame74.Name = "03"
625Frame74.Parent = Frame70
626Frame74.Position = UDim2.new(0.142857149, 0, 0.269230783, -2)
627Frame74.Size = UDim2.new(0.0476190485, 0, 0, 4)
628Frame74.BackgroundColor = BrickColor.new("Institutional white")
629Frame74.BackgroundColor3 = Color3.new(1, 1, 1)
630Frame74.BorderColor = BrickColor.new("Really black")
631Frame74.BorderColor3 = Color3.new(0, 0, 0)
632Frame74.BorderSizePixel = 0
633Frame74.ZIndex = 10
634Frame75.Name = "04"
635Frame75.Parent = Frame70
636Frame75.Position = UDim2.new(0.190476194, 0, 0.192307696, -2)
637Frame75.Size = UDim2.new(0.0476190485, 0, 0, 4)
638Frame75.BackgroundColor = BrickColor.new("Institutional white")
639Frame75.BackgroundColor3 = Color3.new(1, 1, 1)
640Frame75.BorderColor = BrickColor.new("Really black")
641Frame75.BorderColor3 = Color3.new(0, 0, 0)
642Frame75.BorderSizePixel = 0
643Frame75.ZIndex = 10
644Frame76.Name = "05"
645Frame76.Parent = Frame70
646Frame76.Position = UDim2.new(0.238095239, 0, 0.115384616, -2)
647Frame76.Size = UDim2.new(0.0476190485, 0, 0, 4)
648Frame76.BackgroundColor = BrickColor.new("Institutional white")
649Frame76.BackgroundColor3 = Color3.new(1, 1, 1)
650Frame76.BorderColor = BrickColor.new("Really black")
651Frame76.BorderColor3 = Color3.new(0, 0, 0)
652Frame76.BorderSizePixel = 0
653Frame76.ZIndex = 10
654Frame77.Name = "06"
655Frame77.Parent = Frame70
656Frame77.Position = UDim2.new(0.285714298, 0, 0.0384615399, -2)
657Frame77.Size = UDim2.new(0.0476190485, 0, 0, 4)
658Frame77.BackgroundColor = BrickColor.new("Institutional white")
659Frame77.BackgroundColor3 = Color3.new(1, 1, 1)
660Frame77.BorderColor = BrickColor.new("Really black")
661Frame77.BorderColor3 = Color3.new(0, 0, 0)
662Frame77.BorderSizePixel = 0
663Frame77.ZIndex = 10
664Frame78.Name = "07"
665Frame78.Parent = Frame70
666Frame78.Position = UDim2.new(0.333333343, 0, 0, -2)
667Frame78.Size = UDim2.new(0.0476190485, 0, 0, 4)
668Frame78.BackgroundColor = BrickColor.new("Institutional white")
669Frame78.BackgroundColor3 = Color3.new(1, 1, 1)
670Frame78.BorderColor = BrickColor.new("Really black")
671Frame78.BorderColor3 = Color3.new(0, 0, 0)
672Frame78.BorderSizePixel = 0
673Frame78.ZIndex = 10
674Frame79.Name = "08"
675Frame79.Parent = Frame70
676Frame79.Position = UDim2.new(0.380952388, 0, 0.142857149, -2)
677Frame79.Size = UDim2.new(0.0476190485, 0, 0, 4)
678Frame79.BackgroundColor = BrickColor.new("Institutional white")
679Frame79.BackgroundColor3 = Color3.new(1, 1, 1)
680Frame79.BorderColor = BrickColor.new("Really black")
681Frame79.BorderColor3 = Color3.new(0, 0, 0)
682Frame79.BorderSizePixel = 0
683Frame79.ZIndex = 10
684Frame80.Name = "09"
685Frame80.Parent = Frame70
686Frame80.Position = UDim2.new(0.428571433, 0, 0.285714298, -2)
687Frame80.Size = UDim2.new(0.0476190485, 0, 0, 4)
688Frame80.BackgroundColor = BrickColor.new("Institutional white")
689Frame80.BackgroundColor3 = Color3.new(1, 1, 1)
690Frame80.BorderColor = BrickColor.new("Really black")
691Frame80.BorderColor3 = Color3.new(0, 0, 0)
692Frame80.BorderSizePixel = 0
693Frame80.ZIndex = 10
694Frame81.Name = "10"
695Frame81.Parent = Frame70
696Frame81.Position = UDim2.new(0.476190478, 0, 0.428571433, -2)
697Frame81.Size = UDim2.new(0.0476190485, 0, 0, 4)
698Frame81.BackgroundColor = BrickColor.new("Institutional white")
699Frame81.BackgroundColor3 = Color3.new(1, 1, 1)
700Frame81.BorderColor = BrickColor.new("Really black")
701Frame81.BorderColor3 = Color3.new(0, 0, 0)
702Frame81.BorderSizePixel = 0
703Frame81.ZIndex = 10
704Frame82.Name = "11"
705Frame82.Parent = Frame70
706Frame82.Position = UDim2.new(0.523809552, 0, 0.571428597, -2)
707Frame82.Size = UDim2.new(0.0476190485, 0, 0, 4)
708Frame82.BackgroundColor = BrickColor.new("Institutional white")
709Frame82.BackgroundColor3 = Color3.new(1, 1, 1)
710Frame82.BorderColor = BrickColor.new("Really black")
711Frame82.BorderColor3 = Color3.new(0, 0, 0)
712Frame82.BorderSizePixel = 0
713Frame82.ZIndex = 10
714Frame83.Name = "12"
715Frame83.Parent = Frame70
716Frame83.Position = UDim2.new(0.571428597, 0, 0.714285731, -2)
717Frame83.Size = UDim2.new(0.0476190485, 0, 0, 4)
718Frame83.BackgroundColor = BrickColor.new("Institutional white")
719Frame83.BackgroundColor3 = Color3.new(1, 1, 1)
720Frame83.BorderColor = BrickColor.new("Really black")
721Frame83.BorderColor3 = Color3.new(0, 0, 0)
722Frame83.BorderSizePixel = 0
723Frame83.ZIndex = 10
724Frame84.Name = "13"
725Frame84.Parent = Frame70
726Frame84.Position = UDim2.new(0.619047642, 0, 0.857142866, -2)
727Frame84.Size = UDim2.new(0.0476190485, 0, 0, 4)
728Frame84.BackgroundColor = BrickColor.new("Institutional white")
729Frame84.BackgroundColor3 = Color3.new(1, 1, 1)
730Frame84.BorderColor = BrickColor.new("Really black")
731Frame84.BorderColor3 = Color3.new(0, 0, 0)
732Frame84.BorderSizePixel = 0
733Frame84.ZIndex = 10
734Frame85.Name = "14"
735Frame85.Parent = Frame70
736Frame85.Position = UDim2.new(0.666666687, 0, 0.916666687, -2)
737Frame85.Size = UDim2.new(0.0476190485, 0, 0, 4)
738Frame85.BackgroundColor = BrickColor.new("Institutional white")
739Frame85.BackgroundColor3 = Color3.new(1, 1, 1)
740Frame85.BorderColor = BrickColor.new("Really black")
741Frame85.BorderColor3 = Color3.new(0, 0, 0)
742Frame85.BorderSizePixel = 0
743Frame85.ZIndex = 10
744Frame86.Name = "15"
745Frame86.Parent = Frame70
746Frame86.Position = UDim2.new(0.714285731, 0, 0.833333313, -2)
747Frame86.Size = UDim2.new(0.0476190485, 0, 0, 4)
748Frame86.BackgroundColor = BrickColor.new("Institutional white")
749Frame86.BackgroundColor3 = Color3.new(1, 1, 1)
750Frame86.BorderColor = BrickColor.new("Really black")
751Frame86.BorderColor3 = Color3.new(0, 0, 0)
752Frame86.BorderSizePixel = 0
753Frame86.ZIndex = 10
754Frame87.Name = "16"
755Frame87.Parent = Frame70
756Frame87.Position = UDim2.new(0.761904776, 0, 0.75, -2)
757Frame87.Size = UDim2.new(0.0476190485, 0, 0, 4)
758Frame87.BackgroundColor = BrickColor.new("Institutional white")
759Frame87.BackgroundColor3 = Color3.new(1, 1, 1)
760Frame87.BorderColor = BrickColor.new("Really black")
761Frame87.BorderColor3 = Color3.new(0, 0, 0)
762Frame87.BorderSizePixel = 0
763Frame87.ZIndex = 10
764Frame88.Name = "17"
765Frame88.Parent = Frame70
766Frame88.Position = UDim2.new(0.809523821, 0, 0.666666687, -2)
767Frame88.Size = UDim2.new(0.0476190485, 0, 0, 4)
768Frame88.BackgroundColor = BrickColor.new("Institutional white")
769Frame88.BackgroundColor3 = Color3.new(1, 1, 1)
770Frame88.BorderColor = BrickColor.new("Really black")
771Frame88.BorderColor3 = Color3.new(0, 0, 0)
772Frame88.BorderSizePixel = 0
773Frame88.ZIndex = 10
774Frame89.Name = "18"
775Frame89.Parent = Frame70
776Frame89.Position = UDim2.new(0.857142866, 0, 0.583333313, -2)
777Frame89.Size = UDim2.new(0.0476190485, 0, 0, 4)
778Frame89.BackgroundColor = BrickColor.new("Institutional white")
779Frame89.BackgroundColor3 = Color3.new(1, 1, 1)
780Frame89.BorderColor = BrickColor.new("Really black")
781Frame89.BorderColor3 = Color3.new(0, 0, 0)
782Frame89.BorderSizePixel = 0
783Frame89.ZIndex = 10
784Frame90.Name = "19"
785Frame90.Parent = Frame70
786Frame90.Position = UDim2.new(0.90476191, 0, 0.5, -2)
787Frame90.Size = UDim2.new(0.0476190485, 0, 0, 4)
788Frame90.BackgroundColor = BrickColor.new("Institutional white")
789Frame90.BackgroundColor3 = Color3.new(1, 1, 1)
790Frame90.BorderColor = BrickColor.new("Really black")
791Frame90.BorderColor3 = Color3.new(0, 0, 0)
792Frame90.BorderSizePixel = 0
793Frame90.ZIndex = 10
794Frame91.Name = "20"
795Frame91.Parent = Frame70
796Frame91.Position = UDim2.new(0.952000022, 0, 0.49000001, -2)
797Frame91.Size = UDim2.new(0.0476190485, 0, 0, 4)
798Frame91.BackgroundColor = BrickColor.new("Institutional white")
799Frame91.BackgroundColor3 = Color3.new(1, 1, 1)
800Frame91.BorderColor = BrickColor.new("Really black")
801Frame91.BorderColor3 = Color3.new(0, 0, 0)
802Frame91.BorderSizePixel = 0
803Frame91.ZIndex = 10
804Frame92.Name = "Line"
805Frame92.Parent = Frame70
806Frame92.Position = UDim2.new(1, 0, 0.5, -2)
807Frame92.Size = UDim2.new(0, 200, 0, 3)
808Frame92.BackgroundColor = BrickColor.new("Institutional white")
809Frame92.BackgroundColor3 = Color3.new(1, 1, 1)
810Frame92.BorderColor = BrickColor.new("Really black")
811Frame92.BorderColor3 = Color3.new(0, 0, 0)
812Frame92.BorderSizePixel = 0
813Frame92.ZIndex = 10
814Frame93.Name = "Line"
815Frame93.Parent = Frame70
816Frame93.Position = UDim2.new(0, -200, 0.5, -2)
817Frame93.Size = UDim2.new(0, 200, 0, 3)
818Frame93.BackgroundColor = BrickColor.new("Institutional white")
819Frame93.BackgroundColor3 = Color3.new(1, 1, 1)
820Frame93.BorderColor = BrickColor.new("Really black")
821Frame93.BorderColor3 = Color3.new(0, 0, 0)
822Frame93.BorderSizePixel = 0
823Frame93.ZIndex = 10
824Frame94.Name = "Controls"
825Frame94.Parent = Frame56
826Frame94.Position = UDim2.new(0, 0, 0, -200)
827Frame94.Visible = false
828Frame94.Size = UDim2.new(1, 0, 0, 120)
829Frame94.BackgroundColor = BrickColor.new("Black")
830Frame94.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
831Frame94.BackgroundTransparency = 0.30000001192093
832Frame94.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
833Frame94.BorderSizePixel = 5
834Frame94.ZIndex = 10
835TextLabel95.Name = "Title"
836TextLabel95.Parent = Frame94
837TextLabel95.Size = UDim2.new(1, 0, 0, 15)
838TextLabel95.BackgroundColor = BrickColor.new("Institutional white")
839TextLabel95.BackgroundColor3 = Color3.new(1, 1, 1)
840TextLabel95.BackgroundTransparency = 1
841TextLabel95.ZIndex = 10
842TextLabel95.Font = Enum.Font.SourceSansBold
843TextLabel95.FontSize = Enum.FontSize.Size14
844TextLabel95.Text = "CONTROLS"
845TextLabel95.TextColor = BrickColor.new("Institutional white")
846TextLabel95.TextColor3 = Color3.new(1, 1, 1)
847TextLabel95.TextSize = 14
848TextLabel96.Name = "Line"
849TextLabel96.Parent = TextLabel95
850TextLabel96.Position = UDim2.new(0, 0, 1, 1)
851TextLabel96.Size = UDim2.new(1, 0, 0, 2)
852TextLabel96.BackgroundColor = BrickColor.new("New Yeller")
853TextLabel96.BackgroundColor3 = Color3.new(1, 1, 0)
854TextLabel96.BorderSizePixel = 0
855TextLabel96.ZIndex = 10
856TextLabel96.Font = Enum.Font.SourceSans
857TextLabel96.FontSize = Enum.FontSize.Size14
858TextLabel96.Text = ""
859TextLabel96.TextSize = 14
860Frame97.Name = "Grenades"
861Frame97.Parent = Frame56
862Frame97.Position = UDim2.new(0, 0, 0, 90)
863Frame97.Visible = false
864Frame97.Size = UDim2.new(0, 175, 0, 25)
865Frame97.BackgroundTransparency = 1
866Frame97.ZIndex = 10
867Frame98.Name = "Lethals"
868Frame98.Parent = Frame97
869Frame98.Size = UDim2.new(0.5, -2, 1, 0)
870Frame98.BackgroundColor = BrickColor.new("Institutional white")
871Frame98.BackgroundColor3 = Color3.new(1, 1, 1)
872Frame98.BackgroundTransparency = 0.80000001192093
873Frame98.BorderSizePixel = 0
874Frame98.ZIndex = 10
875ImageLabel99.Name = "Icon"
876ImageLabel99.Parent = Frame98
877ImageLabel99.Position = UDim2.new(0, 7, 0, 2)
878ImageLabel99.Size = UDim2.new(0, 21, 0, 21)
879ImageLabel99.BackgroundColor = BrickColor.new("Institutional white")
880ImageLabel99.BackgroundColor3 = Color3.new(1, 1, 1)
881ImageLabel99.BackgroundTransparency = 1
882ImageLabel99.ZIndex = 10
883TextLabel100.Name = "Mult"
884TextLabel100.Parent = Frame98
885TextLabel100.Position = UDim2.new(0.5, -10, 0, 0)
886TextLabel100.Size = UDim2.new(0, 20, 1, 0)
887TextLabel100.BackgroundColor = BrickColor.new("Institutional white")
888TextLabel100.BackgroundColor3 = Color3.new(1, 1, 1)
889TextLabel100.BackgroundTransparency = 1
890TextLabel100.BorderSizePixel = 0
891TextLabel100.ZIndex = 10
892TextLabel100.Font = Enum.Font.ArialBold
893TextLabel100.FontSize = Enum.FontSize.Size18
894TextLabel100.Text = "X"
895TextLabel100.TextColor = BrickColor.new("Institutional white")
896TextLabel100.TextColor3 = Color3.new(1, 1, 1)
897TextLabel100.TextSize = 18
898TextLabel101.Name = "Num"
899TextLabel101.Parent = Frame98
900TextLabel101.Position = UDim2.new(1, -7, 0, 0)
901TextLabel101.Size = UDim2.new(0, 0, 1, 0)
902TextLabel101.BackgroundColor = BrickColor.new("Institutional white")
903TextLabel101.BackgroundColor3 = Color3.new(1, 1, 1)
904TextLabel101.BackgroundTransparency = 1
905TextLabel101.ZIndex = 10
906TextLabel101.Font = Enum.Font.ArialBold
907TextLabel101.FontSize = Enum.FontSize.Size18
908TextLabel101.Text = "0"
909TextLabel101.TextColor = BrickColor.new("Institutional white")
910TextLabel101.TextColor3 = Color3.new(1, 1, 1)
911TextLabel101.TextSize = 18
912TextLabel101.TextXAlignment = Enum.TextXAlignment.Right
913Frame102.Name = "Tacticals"
914Frame102.Parent = Frame97
915Frame102.Position = UDim2.new(0.5, 2, 0, 0)
916Frame102.Size = UDim2.new(0.5, -2, 1, 0)
917Frame102.BackgroundColor = BrickColor.new("Institutional white")
918Frame102.BackgroundColor3 = Color3.new(1, 1, 1)
919Frame102.BackgroundTransparency = 0.80000001192093
920Frame102.BorderSizePixel = 0
921Frame102.ZIndex = 10
922ImageLabel103.Name = "Icon"
923ImageLabel103.Parent = Frame102
924ImageLabel103.Position = UDim2.new(0, 7, 0, 2)
925ImageLabel103.Size = UDim2.new(0, 21, 0, 21)
926ImageLabel103.BackgroundColor = BrickColor.new("Institutional white")
927ImageLabel103.BackgroundColor3 = Color3.new(1, 1, 1)
928ImageLabel103.BackgroundTransparency = 1
929ImageLabel103.ZIndex = 10
930TextLabel104.Name = "Num"
931TextLabel104.Parent = Frame102
932TextLabel104.Position = UDim2.new(1, -7, 0, 0)
933TextLabel104.Size = UDim2.new(0, 0, 1, 0)
934TextLabel104.BackgroundColor = BrickColor.new("Institutional white")
935TextLabel104.BackgroundColor3 = Color3.new(1, 1, 1)
936TextLabel104.BackgroundTransparency = 1
937TextLabel104.ZIndex = 10
938TextLabel104.Font = Enum.Font.ArialBold
939TextLabel104.FontSize = Enum.FontSize.Size18
940TextLabel104.Text = "0"
941TextLabel104.TextColor = BrickColor.new("Institutional white")
942TextLabel104.TextColor3 = Color3.new(1, 1, 1)
943TextLabel104.TextSize = 18
944TextLabel104.TextXAlignment = Enum.TextXAlignment.Right
945TextLabel105.Name = "Mult"
946TextLabel105.Parent = Frame102
947TextLabel105.Position = UDim2.new(0.5, -10, 0, 0)
948TextLabel105.Size = UDim2.new(0, 20, 1, 0)
949TextLabel105.BackgroundColor = BrickColor.new("Institutional white")
950TextLabel105.BackgroundColor3 = Color3.new(1, 1, 1)
951TextLabel105.BackgroundTransparency = 1
952TextLabel105.BorderSizePixel = 0
953TextLabel105.ZIndex = 10
954TextLabel105.Font = Enum.Font.ArialBold
955TextLabel105.FontSize = Enum.FontSize.Size18
956TextLabel105.Text = "X"
957TextLabel105.TextColor = BrickColor.new("Institutional white")
958TextLabel105.TextColor3 = Color3.new(1, 1, 1)
959TextLabel105.TextSize = 18
960Frame106.Name = "gunName"
961Frame106.Parent = Frame56
962Frame106.Size = UDim2.new(1, 0, 0, 36)
963Frame106.BackgroundColor = BrickColor.new("Institutional white")
964Frame106.BackgroundColor3 = Color3.new(0.972549, 0.972549, 0.972549)
965Frame106.BackgroundTransparency = 1
966Frame106.ZIndex = 10
967TextLabel107.Name = "Line"
968TextLabel107.Parent = Frame106
969TextLabel107.Size = UDim2.new(0, 2, 1, 0)
970TextLabel107.BackgroundColor = BrickColor.new("Institutional white")
971TextLabel107.BackgroundColor3 = Color3.new(1, 1, 1)
972TextLabel107.BorderSizePixel = 0
973TextLabel107.ZIndex = 10
974TextLabel107.Font = Enum.Font.SourceSans
975TextLabel107.FontSize = Enum.FontSize.Size14
976TextLabel107.Text = ""
977TextLabel107.TextSize = 14
978TextLabel108.Name = "Line"
979TextLabel108.Parent = Frame106
980TextLabel108.Position = UDim2.new(0, 0, 1, 0)
981TextLabel108.Size = UDim2.new(1, 0, 0, 2)
982TextLabel108.BackgroundColor = BrickColor.new("Institutional white")
983TextLabel108.BackgroundColor3 = Color3.new(1, 1, 1)
984TextLabel108.BorderSizePixel = 0
985TextLabel108.ZIndex = 10
986TextLabel108.Font = Enum.Font.SourceSans
987TextLabel108.FontSize = Enum.FontSize.Size14
988TextLabel108.Text = ""
989TextLabel108.TextSize = 14
990TextLabel109.Name = "Title"
991TextLabel109.Parent = Frame106
992TextLabel109.Position = UDim2.new(0, 7, 0, 0)
993TextLabel109.Size = UDim2.new(1, -7, 1, 0)
994TextLabel109.BackgroundColor = BrickColor.new("Institutional white")
995TextLabel109.BackgroundColor3 = Color3.new(1, 1, 1)
996TextLabel109.BackgroundTransparency = 1
997TextLabel109.ZIndex = 10
998TextLabel109.Font = Enum.Font.SourceSansBold
999TextLabel109.FontSize = Enum.FontSize.Size36
1000TextLabel109.Text = "Gun"
1001TextLabel109.TextColor = BrickColor.new("Institutional white")
1002TextLabel109.TextColor3 = Color3.new(1, 1, 1)
1003TextLabel109.TextSize = 36
1004TextLabel109.TextStrokeTransparency = 0
1005TextLabel109.TextXAlignment = Enum.TextXAlignment.Left
1006Frame110.Name = "fireSelect"
1007Frame110.Parent = ScreenGui42
1008Frame110.Position = UDim2.new(0.5, 0, 0.5, -18)
1009Frame110.Visible = false
1010Frame110.BackgroundColor = BrickColor.new("Institutional white")
1011Frame110.BackgroundColor3 = Color3.new(1, 1, 1)
1012Frame110.BackgroundTransparency = 1
1013Frame111.Name = "Modes"
1014Frame111.Parent = Frame110
1015Frame111.BackgroundColor = BrickColor.new("Institutional white")
1016Frame111.BackgroundColor3 = Color3.new(1, 1, 1)
1017Frame111.BackgroundTransparency = 1
1018ImageLabel112.Name = "Circle"
1019ImageLabel112.Parent = Frame110
1020ImageLabel112.Position = UDim2.new(0, -60, 0, -60)
1021ImageLabel112.Size = UDim2.new(0, 120, 0, 120)
1022ImageLabel112.BackgroundColor = BrickColor.new("Institutional white")
1023ImageLabel112.BackgroundColor3 = Color3.new(1, 1, 1)
1024ImageLabel112.BackgroundTransparency = 1
1025ImageLabel112.Image = "http://www.roblox.com/asset/?id=55754953"
1026ImageLabel112.ImageTransparency = 0.5
1027ImageLabel113.Name = "Arrow"
1028ImageLabel113.Parent = Frame110
1029ImageLabel113.Position = UDim2.new(0, -20, 0, -140)
1030ImageLabel113.Size = UDim2.new(0, 40, 0, 20)
1031ImageLabel113.BackgroundColor = BrickColor.new("Institutional white")
1032ImageLabel113.BackgroundColor3 = Color3.new(1, 1, 1)
1033ImageLabel113.BackgroundTransparency = 1
1034ImageLabel113.Image = "http://www.roblox.com/asset/?id=126877530"
1035Frame114.Name = "Scope"
1036Frame114.Parent = ScreenGui42
1037Frame114.Position = UDim2.new(0, 0, 0, -36)
1038Frame114.Size = UDim2.new(1, 0, 1, 36)
1039Frame114.BackgroundColor = BrickColor.new("Really black")
1040Frame114.BackgroundColor3 = Color3.new(0, 0, 0)
1041Frame114.BackgroundTransparency = 1
1042TextLabel115.Name = "Steady"
1043TextLabel115.Parent = Frame114
1044TextLabel115.Position = UDim2.new(0.5, -60, 0.5, 50)
1045TextLabel115.Visible = false
1046TextLabel115.Size = UDim2.new(0, 120, 0, 20)
1047TextLabel115.BackgroundColor = BrickColor.new("Institutional white")
1048TextLabel115.BackgroundColor3 = Color3.new(1, 1, 1)
1049TextLabel115.BackgroundTransparency = 1
1050TextLabel115.ZIndex = 9
1051TextLabel115.Font = Enum.Font.ArialBold
1052TextLabel115.FontSize = Enum.FontSize.Size14
1053TextLabel115.Text = ""
1054TextLabel115.TextColor = BrickColor.new("New Yeller")
1055TextLabel115.TextColor3 = Color3.new(1, 1, 0)
1056TextLabel115.TextSize = 14
1057TextLabel115.TextStrokeTransparency = 0
1058Frame116.Name = "Main"
1059Frame116.Parent = Frame114
1060Frame116.Visible = false
1061Frame116.Size = UDim2.new(1, 0, 1, 0)
1062Frame116.BackgroundColor = BrickColor.new("Institutional white")
1063Frame116.BackgroundColor3 = Color3.new(1, 1, 1)
1064Frame116.BackgroundTransparency = 1
1065ImageLabel117.Name = "ScopeImg2"
1066ImageLabel117.Parent = Frame116
1067ImageLabel117.Position = UDim2.new(0.5, -10, 0, -10)
1068ImageLabel117.Size = UDim2.new(0, 20, 0, 20)
1069ImageLabel117.BackgroundColor = BrickColor.new("Really black")
1070ImageLabel117.BackgroundColor3 = Color3.new(0, 0, 0)
1071ImageLabel117.BackgroundTransparency = 1
1072ImageLabel117.Image = "http://www.roblox.com/asset/?id=184922644"
1073ImageLabel118.Name = "ScopeImg1"
1074ImageLabel118.Parent = Frame116
1075ImageLabel118.Position = UDim2.new(0.5, -10, 0, -10)
1076ImageLabel118.Size = UDim2.new(0, 20, 0, 20)
1077ImageLabel118.BackgroundColor = BrickColor.new("Really black")
1078ImageLabel118.BackgroundColor3 = Color3.new(0, 0, 0)
1079ImageLabel118.BackgroundTransparency = 1
1080ImageLabel118.Image = "http://www.roblox.com/asset/?id=72002022"
1081Frame119.Name = "F2"
1082Frame119.Parent = Frame116
1083Frame119.Position = UDim2.new(0, -10, 0, -10)
1084Frame119.Size = UDim2.new(0, 0, 1, 20)
1085Frame119.BackgroundColor = BrickColor.new("Really black")
1086Frame119.BackgroundColor3 = Color3.new(0, 0, 0)
1087Frame119.BorderColor = BrickColor.new("Really black")
1088Frame119.BorderColor3 = Color3.new(0, 0, 0)
1089Frame119.BorderSizePixel = 0
1090Frame120.Name = "F1"
1091Frame120.Parent = Frame116
1092Frame120.Position = UDim2.new(0, -10, 0, -10)
1093Frame120.Size = UDim2.new(0, 0, 1, 20)
1094Frame120.BackgroundColor = BrickColor.new("Really black")
1095Frame120.BackgroundColor3 = Color3.new(0, 0, 0)
1096Frame120.BorderColor = BrickColor.new("Really black")
1097Frame120.BorderColor3 = Color3.new(0, 0, 0)
1098Frame120.BorderSizePixel = 0
1099LocalScript121.Name = "Update"
1100LocalScript121.Parent = Frame116
1101table.insert(cors,sandbox(LocalScript121,function()
1102local GUI = script.Parent
1103
1104function updateScopeDimension()
1105 GUI.ScopeImg1.Position = UDim2.new(0.5, -10 - (GUI.AbsoluteSize.y / 2), 0, -10)
1106 GUI.ScopeImg1.Size = UDim2.new(0, 20 + GUI.AbsoluteSize.y, 0, 20 + GUI.AbsoluteSize.y)
1107 GUI.ScopeImg2.Position = UDim2.new(0.5, -10 - (GUI.AbsoluteSize.y / 2), 0, -10)
1108 GUI.ScopeImg2.Size = UDim2.new(0, 20 + GUI.AbsoluteSize.y, 0, 20 + GUI.AbsoluteSize.y)
1109 GUI.F1.Size = UDim2.new(0, 20 + ((GUI.AbsoluteSize.x - GUI.AbsoluteSize.y) / 2), 1, 20)
1110 GUI.F2.Size = UDim2.new(0, 20 + ((GUI.AbsoluteSize.x - GUI.AbsoluteSize.y) / 2), 1, 20)
1111 GUI.F2.Position = UDim2.new(1, -10 - ((GUI.AbsoluteSize.x - GUI.AbsoluteSize.y) / 2), 0, -10)
1112end
1113
1114wait()
1115
1116GUI.Changed:connect(updateScopeDimension)
1117
1118updateScopeDimension()
1119end))
1120TextLabel122.Name = "Sens"
1121TextLabel122.Parent = ScreenGui42
1122TextLabel122.Position = UDim2.new(0.5, -50, 0.5, 50)
1123TextLabel122.Visible = false
1124TextLabel122.Size = UDim2.new(0, 100, 0, 20)
1125TextLabel122.BackgroundColor = BrickColor.new("Institutional white")
1126TextLabel122.BackgroundColor3 = Color3.new(1, 1, 1)
1127TextLabel122.BackgroundTransparency = 1
1128TextLabel122.ZIndex = 10
1129TextLabel122.Font = Enum.Font.SourceSansBold
1130TextLabel122.FontSize = Enum.FontSize.Size28
1131TextLabel122.Text = "S: 0.3"
1132TextLabel122.TextColor = BrickColor.new("Institutional white")
1133TextLabel122.TextColor3 = Color3.new(1, 1, 1)
1134TextLabel122.TextSize = 28
1135TextLabel122.TextStrokeTransparency = 0
1136ModuleScript123.Name = "ANIMATIONS"
1137ModuleScript123.Parent = Tool0
1138table.insert(cors,sandbox(ModuleScript123,function()
1139--[[
1140
1141 This module script contains all the main animations. I put it into this script so it'll be easier to edit.
1142
1143 Both arms are welded to a single brick called "animBase". This makes it easier to edit movement animations because you only have to
1144 edit the cframe of one brick instead of 2 arms.
1145
1146 The idling, walking, and running animations have a Pos and a Rot component. The Pos component is the position of the weld and the Rot component
1147 is the rotation of the weld. They're vector3 values so the script can multiply each value by an alpha and add them together to make the smooth
1148 transitions possible
1149
1150 The table directly below lets you know how each component of the Vector affects the movement of the weld so it's easier to edit
1151
1152 This module also contains the reload animation which I moved here for easier editing. The animation function has a parameter S that contains all
1153 the functions and variables that are necessary to make the animation run
1154
1155 HOW TO EDIT THE RELOAD ANIMATION:
1156 -Make sure each block of the animation is made into a separate function, it needs to be like this so if the reload animation needs to be stopped
1157 midway, the arms don't glitch out
1158 -Each animation piece should only have one wait command at the end of the function
1159 -Multiply every duration value, including the wait time values by the animSpeed. That way if you change the reload time, you won't have to change
1160 each individual time value for all the animation components
1161
1162--]]
1163
1164local Animations = {
1165
1166 Reload = function(S) --This is the main reload animation. The parameter S contains all the variables and functions that are necessary for this animation
1167 --[[
1168 FUNCTION LIST_
1169
1170 S.tweenJoint(Joint, newC0, newC1, Alpha, Duration) --This function tweens a joint to a given C0 and C1. The Alpha parameter is function
1171 that returns a number between 0 and 1 given an argument of a number between 0 and 90. The Duration is how fast the joint tweens. NOTE,
1172 you can put nil as an argument for the newC0 or newC1 parameter and the function won't tween that specific property of the weld. This
1173 is useful if you only want to mess with the C0 or C1 property of a weld.
1174
1175 S.makeMagInvisible() --This function makes the mag invisible so it looks like the mag was removed
1176
1177 S.makeMagVisible() --This function makes the mag visible again at whatever the previous transparency of the mag parts were
1178
1179 S.isMagVisible() --This function returns a true or false value based on whether or not the mag is visible. This can be used to tell if
1180 the animation was stopped midway and where to restart the animation
1181
1182 S.isMagEmpty() --This function returns a true or false value based on whether or not the mag is empty, meaning the ammo is 0. This can be
1183 used to decide if a chambering animation should play after the reload animation
1184
1185 S.setNewMag() --This function sets the newMag variable in the clientMain to true which basically lets the script know that a new mag was
1186 put into the gun. This is used so that if the reload animation is broken after the new mag was put in but before the chambering animation
1187 then the script will simply play the chambering animation instead of putting in another mag
1188
1189 S.isNewMag() --This function returns a true or false value based on whether or not the mag that is currently attached to the gun is a new
1190 mag. In order for it to be a new mag, it needs to have full ammo. Once you fire, the mag becomes an old mag
1191
1192 S.createMag(Key) --This functions clones the Mag and puts it in a table with a Key parameter so you can access the mag in a separate
1193 function and it returns a Model containing the Mag and a table that contains the original mag bricks and the corresponding clone. NOTE,
1194 the mag bricks will be made non can collide
1195
1196 S.getMag(Key) --This function gets a Mag from the mag table given a Key argument and it returns the model that the mag is contained in
1197 and the brick that all the other mag parts are welded to
1198
1199 S.attachGripToHead() --This function detaches the grip from the right arm and attaches it to the Head. This is so you can make reload
1200 animations that require using the right arm to manipulate the gun in any way. The C0 of the grip is changed so the gun stays in the
1201 position that it was in before you detached the grip from the right arm.
1202
1203 S.attachGripToArm() --This function detaches the grip from the Head and attaches it to the Arm. The C0 of the grip is changed so the gun
1204 stays in the position that it was in before you detached the grip from the head
1205
1206 S.Sine(X) --This function is an Alpha function for the tweenJoint function. Given a number between 0 and 90, the function will return the
1207 sine of that number, which is a number between 0 and 1, which is used to tween a Joint with a Sine movement
1208
1209 S.Linear(X) --This function is an Alpha function for the tweenJoint function. Given a number between 0 and 90, the function will return
1210 the number / 90, which is a number between 0 and 1, which is used to a tween a Joint with a Linear movement
1211
1212 VARIABLE LIST_
1213
1214 S.Handle --This variable is the Handle of gun
1215
1216 S.LArm --This variable is the left arm
1217
1218 S.RArm --This variable is the right arm
1219
1220 S.LWeld --This variable is the left arm weld which is attached to the animBase
1221
1222 S.RWeld --This variable is the right arm weld which is attached to the animBase
1223
1224 S.LC0 --This variable is the cframe of the left arm joint with respect to the torso
1225
1226 S.RC0 --This variable is the cframe of the right arm joint with respect to the torso
1227
1228 S.Grip --This variable is the Grip weld which is attached to right arm
1229
1230 S.gunIgnore --This variable is the gun ignore model which contains the fake arms and bullets and other stuff
1231
1232 S.Cam --This variable is the player camera
1233
1234 S.CF --This variable is the shortened form of CFrame.new which you can use instead of CFrame.new
1235
1236 S.CFANG --This variable is the shortened form of CFrame.Angles which you can use instead of CFrame.Angles
1237
1238 S.V3 --This variable is the shortened form of Vector3.new which you can use instead of Vector3.new
1239
1240 S.RAD --This variable is the shortened form of math.rad which you can use instead of math.rad
1241
1242 S.reloadTimeLoaded --This variable is the reload time for when the gun is loaded which you can use to modify how fast the reload
1243 animation runs
1244
1245 S.reloadTimeEmpty --This variable is the reload time for when the gun is empty which you can use to modify how fast the reload
1246 animation runs
1247 --]]
1248
1249 local W1 = nil
1250 local W2 = nil
1251 local animSpeed = S.isMagEmpty() and S.reloadTimeEmpty / 1.3 or S.reloadTimeLoaded / 0.9
1252 return {
1253 function()
1254 if (not S.isNewMag()) then
1255 if S.isMagVisible() then
1256 local Mag1, magTable1 = S.createMag("Mag1")
1257
1258 Mag1.Parent = S.gunIgnore
1259
1260 W1 = Instance.new("Weld")
1261 W1.Part0 = magTable1[1].magClone
1262 W1.Part1 = S.Handle
1263 W1.C0 = magTable1[1].Original.CFrame:toObjectSpace(S.Handle.CFrame)
1264 W1.Parent = magTable1[1].magClone
1265
1266 S.tweenJoint(S.LWeld, nil, S.CF(-0.9, 2, -1.1) * S.CFANG(S.RAD(-15), 0, S.RAD(-25)), S.Sine, 0.2 * animSpeed)
1267 S.tweenJoint(S.RWeld, nil, S.CF(0.3, 0.2, -0.31) * S.CFANG(S.RAD(-12), 0, S.RAD(25)), S.Sine, 0.2 * animSpeed)
1268 S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.1 * animSpeed)
1269 wait(0.2 * animSpeed)
1270 end
1271 end
1272 end;
1273
1274 function()
1275 if (not S.isNewMag()) then
1276 if S.isMagVisible() then
1277 S.makeMagInvisible()
1278 W1:Destroy()
1279 local Mag1, magTable1 = S.getMag("Mag1")
1280 magTable1[1].magClone.Velocity = S.Handle.Velocity + S.Handle.CFrame:vectorToWorldSpace(S.V3(0, -1, 0)) * 20
1281
1282 S.tweenJoint(S.RWeld, nil, S.CF(0.3, 0.2, -0.5) * S.CFANG(S.RAD(-20), S.RAD(10), S.RAD(25)), S.Sine, 0.25 * animSpeed)
1283 S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
1284 else
1285 S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-12), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
1286 S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
1287 end
1288
1289 S.tweenJoint(S.LWeld, nil, S.CF(0, 0.5, 0) * S.CFANG(S.RAD(95), 0, S.RAD(-25)), S.Sine, 0.2 * animSpeed)
1290
1291 wait(0.25 * animSpeed)
1292 end
1293 end;
1294
1295 function()
1296 if (not S.isNewMag()) then
1297 local Mag1, magTable1 = S.getMag("Mag1")
1298 if Mag1 then Mag1:Destroy() end
1299
1300 local Mag2, magTable2 = S.createMag("Mag2")
1301
1302 Mag2.Parent = S.gunIgnore
1303
1304 local LArmCF = S.LWeld.Part0.CFrame * S.LWeld.C0 * (S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60))):inverse()
1305 local RArmCF = S.RWeld.Part0.CFrame * S.RWeld.C0 * (S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25))):inverse()
1306 local handleOffsetCF = S.RArm.CFrame:toObjectSpace(S.RArm.CFrame * S.Grip.C0 * (S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10))):inverse())
1307 local originalMagOffsetCF = S.Handle.CFrame:toObjectSpace(magTable2[1].Original.CFrame)
1308 local newMagC0 = LArmCF:toObjectSpace(RArmCF * handleOffsetCF * originalMagOffsetCF)
1309
1310 W2 = Instance.new("Weld")
1311 W2.Part0 = S.LArm
1312 W2.Part1 = magTable2[1].magClone
1313 W2.C0 = newMagC0
1314 W2.Parent = magTable2[1].magClone
1315
1316 S.tweenJoint(S.LWeld, nil, S.CF(0.55, 1, -2.4) * S.CFANG(S.RAD(-20), S.RAD(20), S.RAD(-60)), S.Sine, 0.2 * animSpeed)--0.25
1317 S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-12), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
1318 S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
1319 wait(0.2 * animSpeed)
1320 end
1321 end;
1322
1323 function()
1324 if (not S.isNewMag()) then
1325 S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
1326 S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
1327 S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
1328
1329 wait(0.2 * animSpeed)
1330 end
1331 end;
1332
1333 function()
1334 if (not S.isNewMag()) then
1335 local Mag1, _ = S.getMag("Mag1")
1336 local Mag2, _ = S.getMag("Mag2")
1337 S.makeMagVisible()
1338 S.setNewMag()
1339 if Mag1 then Mag1:Destroy() end
1340 Mag2:Destroy()
1341 end
1342 end;
1343
1344 function()
1345 if S.isMagEmpty() then
1346 if S.isNewMag() then
1347 S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
1348 S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
1349 S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
1350 end
1351 S.tweenJoint(S.LWeld, nil, S.CF(0, 1.3, -0.55) * S.CFANG(S.RAD(-26), 0, 0), S.Sine, 0.2 * animSpeed)
1352
1353 wait(0.2 * animSpeed)
1354 end
1355 end;
1356
1357 function()
1358 if S.isMagEmpty() then
1359 S.tweenJoint(S.LWeld, nil, S.CF(0.4, 1.6, -0.55) * S.CFANG(S.RAD(-23), 0, S.RAD(-60)), S.Sine, 0.1 * animSpeed)
1360
1361 wait(0.05 * animSpeed)
1362 end
1363 end;
1364
1365 function()
1366 if S.isMagEmpty() then
1367 S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(20)), S.Sine, 0.05 * animSpeed)
1368
1369 wait(0.15 * animSpeed)
1370 end
1371 end;
1372 }
1373 end;
1374
1375 Cocking = function(S)
1376
1377 end;
1378
1379 Crawling = function(X, moveDirection, moveSpeed) --This is the animation for when you're crawling
1380 --[[
1381 The moveDirection gives you the angle at which your character is moving with respect to the way you're facing. So if you're
1382 moving to the right and you're facing forward then the moveDirection will give you an angle of -90. If you're moving backward
1383 and you're facing forward then the moveDirection will give you an angle of 180. I use this angle to adjust the crawling animation
1384 so that you're arms move in the direction that you're moving so it looks more realistic rather than the arms constantly moving forward
1385
1386 The moveVelocity gives you how fast you're moving in the X-Z plane. It doesn't take your Y-velocity into account so if you're falling your
1387 moveVelocity will still be how fast you're moving horizontally. You can use this to adjust how fast the crawling animation runs so if you're
1388 moving really slow the animation will play slower
1389 --]]
1390 return {
1391 leftArm = CFrame.Angles( --This is what the cframe of the right arm will be when you're crawling
1392 0,
1393 math.rad(90),
1394 math.rad(-10)
1395 ) * CFrame.new(
1396 math.sin(moveDirection) * (math.sin(X * 6) / 4) - 0.2,
1397 math.cos(moveDirection) * (math.sin(X * 6) / 2) - 0.1,
1398 math.max(math.cos(X * 6) / 4, 0) - 0.1
1399 ) * CFrame.Angles(
1400 -math.max(math.cos(X * 6) / 4, 0),
1401 0,
1402 0
1403 );
1404 leftLeg = CFrame.new( --This is what the cframe of the left leg will be when you're crawling
1405 math.sin(moveDirection) * (-math.sin(X * 6) / 4) - 0.2,
1406 math.cos(moveDirection) * (math.sin(X * 6) / 2) + 0.3,
1407 math.max(math.cos(X * 6) / 4, 0) - 0.1
1408 ):inverse() * CFrame.Angles(
1409 0,
1410 0,
1411 -math.rad(15) - math.cos(moveDirection) * (math.rad(15) * math.sin(X * 6))
1412 );
1413 rightArm = CFrame.Angles( --This is what the cframe of the left arm will be when you're crawling
1414 0,
1415 math.rad(-5),
1416 math.rad(10)
1417 ) * CFrame.new(
1418 math.sin(moveDirection) * (-math.sin(X * 6) / 4) + 0.2,
1419 math.cos(moveDirection) * (-math.sin(X * 6) / 5) - 0.2,
1420 math.max(math.cos((X + math.rad(30)) * 6) / 10, 0) - 0.1
1421 ) * CFrame.Angles(
1422 -math.max(math.cos((X + math.rad(30)) * 6) / 10, 0),
1423 0,
1424 0
1425 );
1426 rightLeg = CFrame.new( --This is what the cframe of the right leg will be when you're crawling
1427 math.sin(moveDirection) * (math.sin(X * 6) / 4) + 0.2,
1428 math.cos(moveDirection) * (-math.sin(X * 6) / 2) + 0.3,
1429 math.max(math.cos((X + math.rad(30)) * 6) / 4, 0) - 0.1
1430 ):inverse() * CFrame.Angles(
1431 0,
1432 0,
1433 math.rad(15) - math.cos(moveDirection) * (math.rad(15) * math.sin(X * 6))
1434 );
1435 Grip = CFrame.Angles( --This is what the cframe of the grip will be when you're crawling
1436 math.max(math.cos((X + math.rad(30)) * 6) / 7, 0),
1437 math.rad(5),
1438 0
1439 );
1440 Camera = 1.5 * math.rad(math.cos((X + math.rad(30)) * 6)) + math.rad(0.5); --This is what the roll of the camera will be when you're crawling
1441 }
1442 end;
1443
1444 Idling = { --This table holds the Idling animations
1445
1446 unAimed = function(X) --This is the animation when the gun is not aimed
1447 return {
1448 Pos = Vector3.new(
1449 math.sin(X / 2) / 70, --Side to Side motion
1450 math.sin(X * 5 / 4) / 70, --Up and Down motion
1451 math.sin(X * 3 / 4) / 70 --Forward and backward motion
1452 );
1453 Rot = Vector3.new(
1454 0, --Pitch rotation
1455 0, --Yaw rotation
1456 0 --Roll rotation
1457 );
1458 }
1459 end;
1460
1461 Aimed = function(X) --This is the animation when the gun is aimed
1462 return {
1463 Pos = Vector3.new(
1464 math.sin(X * 3 / 8) / 140,
1465 math.sin(X * 15 / 16) / 140,
1466 0
1467 );
1468 Rot = Vector3.new(
1469 0,
1470 0,
1471 0
1472 );
1473 }
1474 end;
1475
1476 };
1477
1478 Walking = { --This table holds the Walking animations
1479
1480 unAimed = function(X) --This is the animation when the gun is not aimed
1481 return {
1482 Pos = Vector3.new(
1483 4 * math.sin(X * 4.5) / 50,
1484 1.5 * math.sin(X * 9) / 50,
1485 0
1486 );
1487 Rot = Vector3.new(
1488 0,
1489 0,
1490 math.rad(math.sin(X * 4.5)) * 2
1491 );
1492 }
1493 end;
1494
1495 Aimed = function(X) --This is the animation when the gun is aimed
1496 return {
1497 Pos = Vector3.new(
1498 2 * math.sin(X * 3) / 150,
1499 0.75 * math.sin(X * 6) / 150,
1500 0
1501 );
1502 Rot = Vector3.new(
1503 0,
1504 0,
1505 math.rad(math.sin(X * 3)) / 3
1506 );
1507 }
1508 end;
1509
1510 };
1511
1512 Running = function(X) --This is the animation when the player is running
1513 return {
1514 Pos = Vector3.new(
1515 4 * math.sin(X * 4.5 * 1.5) / 30,
1516 1.5 * math.sin(X * 9 * 1.5) / 40 + 0.2,
1517 0
1518 );
1519 Rot = Vector3.new(
1520 0,
1521 -math.rad(math.sin(X * 4.5 * 1.5)) * 5 + math.rad(3),
1522 math.rad(math.sin(X * 4.5 * 1.5)) * 5
1523 );
1524 }
1525 end;
1526
1527}
1528
1529return Animations
1530end))
1531ModuleScript124.Name = "PLUGINS"
1532ModuleScript124.Parent = Tool0
1533table.insert(cors,sandbox(ModuleScript124,function()
1534--[[
1535
1536 Plugins for this gun kit are basically functions that will run at specific times, i.e. When a key is pressed, when the gun is
1537 fired, when the gun is aimed, etc.
1538
1539 HOW TO USE IT:
1540
1541 KEYDOWN PLUGIN:
1542
1543 Let's say you wanted to toggle a laser whenever you press the "v" key:
1544
1545 You would create a table like the example below
1546 The first element would be "Key = INSERT_KEY_HERE"
1547 The second element would be "Description = INSERT_DESCRIPTION_HERE"
1548 The third element would be "Plugin = INSERT_FUNCTION_HERE"
1549
1550 So whenever you press the "v" key, the plugin function will run
1551
1552 Pretty useful if you want to add extra code to the script without actually having to modify the script
1553
1554 NOTE: Only the keydown plugin requires this table. Every other plugin just needs a function
1555
1556 EVERY OTHER PLUGIN:
1557
1558 Let's say you wanted to make a shell eject whenever the gun was fired:
1559
1560 You would add function called "Plugin = INSERT_FUNCTION_HERE"
1561
1562 That's it; If you want other stuff to happen when the gun is fired, you would either put it all into 1 function, or
1563 you would add more Plugins to the "Firing" table. Like so:
1564
1565 Firing = {
1566 Plugin = function()
1567 --Code
1568 end;
1569 Plugin = function()
1570 --Code
1571 end;
1572 Plugin = function()
1573 --Code
1574 end;
1575 };
1576
1577 That's really it, you just need to know some basic scripting to use it. If you have more questions, pm me.
1578
1579 NOTE: The plugins run seperate from the code in the Gun_Main. For example, if you have a plugin that ejects a shell 1 second
1580 after the gun is fired, the gun's firing speed won't be affected in any way.
1581
1582--]]
1583
1584local Gun = script.Parent
1585
1586local Plugins = {
1587
1588 KeyDown = {
1589 { --This is a plugin for a toggleable laser
1590 Key = "v"; --This is the key you press to activate the plugin
1591 Description = "Toggle Laser"; --This is what the description of the key will be in the controls
1592 Plugin = function() --This is the actual plugin function
1593 local Laser = Gun:WaitForChild("Laser") --These few lines wait for the necessary bricks/models
1594 local Handle = Gun:WaitForChild("Handle")
1595 local ignoreCode = Gun.clientMain:WaitForChild("ignoreCode")
1596 local ignoreModel = game.Workspace:WaitForChild("ignoreModel_"..ignoreCode.Value)
1597
1598 local PlyrName = game.Players:GetPlayerFromCharacter(Gun.Parent).Name
1599 local playerFolder = ignoreModel:WaitForChild("gunIgnore_"..PlyrName)
1600
1601 local RS = game:GetService("RunService")
1602
1603 local function createLaserDot() --This function creates the red laser dot
1604 local laserDot = Instance.new("Part")
1605 laserDot.Transparency = 1
1606 laserDot.Name = "laserDot"
1607 laserDot.Anchored = true
1608 laserDot.CanCollide = false
1609 laserDot.FormFactor = Enum.FormFactor.Custom
1610 laserDot.Size = Vector3.new(0.25, 0.25, 1)
1611
1612 local laserGui = Instance.new("SurfaceGui")
1613 laserGui.CanvasSize = Vector2.new(100, 100)
1614 laserGui.Parent = laserDot
1615
1616 local laserImage = Instance.new("ImageLabel")
1617 laserImage.BackgroundTransparency = 1
1618 laserImage.Size = UDim2.new(1, 0, 1, 0)
1619 laserImage.Image = "http://www.roblox.com/asset/?id=131394739"
1620 laserImage.Parent = laserGui
1621
1622 --[[local laserLight = Instance.new("SurfaceLight")
1623 laserLight.Angle = 180
1624 laserLight.Brightness = math.huge
1625 laserLight.Color = Color3.new(1, 0, 0)
1626 laserLight.Face = Enum.NormalId.Back
1627 laserLight.Range = 5
1628 laserLight.Shadows = true
1629 laserLight.Parent = laserDot]]
1630
1631 return laserDot
1632 end
1633
1634 local function getHitSurfaceCFrame(Pos, Obj) --This function returns the proper cframe based on the face that the position is on
1635 local surfaceCF = {
1636 {"Back", Obj.CFrame * CFrame.new(0, 0, Obj.Size.z)};
1637 {"Bottom", Obj.CFrame * CFrame.new(0, -Obj.Size.y, 0)};
1638 {"Front", Obj.CFrame * CFrame.new(0, 0, -Obj.Size.z)};
1639 {"Left", Obj.CFrame * CFrame.new(-Obj.Size.x, 0, 0)};
1640 {"Right", Obj.CFrame * CFrame.new(Obj.Size.x, 0, 0)};
1641 {"Top", Obj.CFrame * CFrame.new(0, Obj.Size.y, 0)}
1642 }
1643 local closestDist = math.huge
1644 local closestSurface = nil
1645 for _,v in pairs(surfaceCF) do
1646 local surfaceDist = (Pos - v[2].p).magnitude
1647 if surfaceDist < closestDist then
1648 closestDist = surfaceDist
1649 closestSurface = v
1650 end
1651 end
1652
1653 local surfaceDir = CFrame.new(Obj.CFrame.p, closestSurface[2].p)
1654 local surfaceDist = surfaceDir.lookVector * ((Obj.CFrame.p - closestSurface[2].p).magnitude / 2 - 0.25)
1655 local surfaceOffset = Pos - closestSurface[2].p + surfaceDist
1656 local surfaceCFrame = surfaceDir + surfaceDist + surfaceOffset
1657
1658 return surfaceCFrame
1659 end
1660
1661 local laserDot = createLaserDot() --The code is cleaner when the laser creating code is in a function
1662
1663 Laser.Transparency = (Laser.Transparency == 1 and 0 or 1) --Toggles the laser on or off
1664
1665 while math.floor(Laser.Transparency) == 0 do --This loop will keep running as long as the laser is visible
1666 if (not game.Players:GetPlayerFromCharacter(Gun.Parent)) then break end --This checks if the gun is a child of the character
1667
1668 local newRay = Ray.new(Laser.Position, Handle.CFrame.lookVector * 999)
1669 local H, P = game.Workspace:FindPartOnRay(newRay, ignoreModel)
1670
1671 local Distance = (P - Laser.Position).magnitude
1672 Laser.Mesh.Offset = Vector3.new(0, Distance / 2, 0)
1673 Laser.Mesh.Scale = Vector3.new(0.075, Distance / 0.2, 0.075)
1674
1675 if H then
1676 laserDot.CFrame = getHitSurfaceCFrame(P, H) --If the laser hits a part then position the dot on the part
1677 laserDot.Parent = playerFolder
1678 else
1679 laserDot.Parent = nil --If the laser doesn't hit a part then temporarily remove the laser dor
1680 end
1681
1682 RS.RenderStepped:wait()
1683 end
1684
1685 laserDot:Destroy() --These lines reset the laser if the laser is transparent or the gun was deselected
1686 Laser.Transparency = 1
1687 Laser.Mesh.Offset = Vector3.new()
1688 Laser.Mesh.Scale = Vector3.new(0.075, 0, 0.075)
1689 end;
1690 };
1691
1692 { --This is a plugin for a toggleable flashlight
1693 Key = "z";
1694 Description = "Toggle Flashlight";
1695 Plugin = function()
1696 local Flashlight = Gun:WaitForChild("Flashlight")
1697 if Flashlight then
1698 for _, Light in pairs(Flashlight:GetChildren()) do
1699 if Light.Name == "Light" then
1700 Light.Enabled = (not Light.Enabled)
1701 end
1702 end
1703 end
1704 end
1705 };
1706 };
1707
1708 KeyUp = {
1709
1710 };
1711
1712 Firing = {
1713 Plugin = function()
1714 --Put code here
1715 end;
1716 };
1717
1718 Aimed = {
1719 Plugin = function()
1720 --Put code here
1721 end;
1722 };
1723
1724 UnAimed = {
1725 Plugin = function()
1726 --Put code here
1727 end;
1728 };
1729
1730 OnEquipped = {
1731 Plugin = function()
1732 --Put code here
1733 end
1734 };
1735
1736 OnUnEquipped = {
1737 Plugin = function()
1738 --Put code here
1739 end
1740 };
1741
1742}
1743
1744return Plugins
1745end))
1746ModuleScript125.Name = "SETTINGS"
1747ModuleScript125.Parent = Tool0
1748table.insert(cors,sandbox(ModuleScript125,function()
1749local Settings = { --These are the settings, change them however you like
1750
1751
1752 gunType = { --[[These are the 5 gun types you can have. Set whichever ones you want to true. (NOTE: Semi and Auto can't both be
1753 true, and Burst and Auto can't both be true)]]
1754 Semi = true; --Set this true if you want the gun to be semi-automatic. (Pistols, Snipers, etc)
1755 Auto = false; --Set this true if you want the gun to be fully automatic. (Assault Rifles, Submachine guns, machine guns, etc)
1756 Burst = false; --Set this true if you want the gun to be burst fire. (Battle rifles, assault rifles, etc)
1757 Shot = false; --Set this true if you want the gun to be a shotgun. (NOTE: Shot and auto can both be true)
1758 Explosive = false; --Set this true if you want the projectiles to be explosive. (Rocket launchers, grenade launchers, etc)
1759 };
1760
1761 selectFire = false; --This is whether or not select fire is enabled
1762 selectFireSettings = {
1763 Animation = true; --This is whether or not there will be an animation for when you switch fire modes
1764 GUI = true; --This is whether or not a gui appears showing the fire being selected
1765 Modes = { --This the list of modes you can switch between
1766 Safety = true; --This mode doesn't allow any form of firing
1767 Semi = true; --This mode allows semi-automatic firing
1768 Burst = true; --This mode allows burst fire. The burst will be based on the burstSettings below
1769 Auto = true; --This mode allows fully automatic fire
1770 };
1771 animSpeed = 0.5; --This is how long it takes to switch fire if GUI or Animation is true. If neither are true, then switching will be instant
1772 };
1773
1774
1775 burstSettings = {
1776 fireRateBurst = true; --[[If this is true, then the burst time and wait will be adjusted so the bullet firing speed is the fire rate. If this
1777 is false, then the burst time and burst wait will be the values below]]
1778 Amount = 3; --This is how many bullets will be fired in one burst (if Burst is true)
1779 Time = 0.2; --This is how long it takes for a burst to complete
1780 Wait = 0.1; --This is how much time you have to wait before you can fire another burst
1781 };
1782
1783
1784 shotAmount = 5; --This is how many bullets will be fired in one shot (if Shot is true)
1785
1786
1787 explosionSettings = {
1788 Radius = 20; --This is the radius of the explosion when the bullet hits a target. (If Explosive is true)
1789 Pressure = 5e5; --This is the pressure of the explosion when the bullet hits the target
1790 Type = Enum.ExplosionType.NoCraters; --This is the type of explosion
1791 --[[
1792 (0 or "NoCraters" or Enum.ExplosionType.NoCraters) means that the explosion will not damage terrain
1793 (1 or "Craters" or Enum.ExplosionType.Craters) means that the explosion will leave craters in terrain
1794 (2 or "CratersAndDebris" or Enum.ExplosionType.CratersAndDebris) means that the explosion will leave craters and debris in terrain
1795 --]]
1796 soundId = "rbxassetid://138499093"; --This is what the sound of the explosion will be
1797 soundPitch = 1; --This is what the pitch of the explosion sound will be
1798 soundVolume = 1; --This is what the volume of the explosion sound will be
1799 rayCastExplosions = false; --[[This is whether or not explosions will have raycasting. If this is true, humanoids behind walls
1800 won't be damaged. If this is false, any humanoid within the radius will be damaged. (NOTE: RangeBasedDamage has to be true in
1801 order for explosions to have raycasting)]]
1802 rangeBasedDamage = true; --[[This is whether or not will depend on how far the object is from the center of the explosion. If this
1803 is true, the farther a humanoid is from the blast center, the less damage it'll take. If this is false, any object within
1804 the explosion's radius will have its joints broken]]
1805 };
1806
1807
1808 playerArms = true; --This is whether or not the fake arms will look like the Player's arms
1809 fakeArmSettings = {
1810 Transparency = 0; --This is the transparency of the fake arms
1811 armSize = Vector3.new(0.6, 2, 0.6); --This is the size of the fake player arms if playerArms is true
1812 characterMeshes = false; --This is whether or not the fake player arms will have the arm meshes if playerArms is true
1813 realBodyColor = true; --This is whether or not the color of the fake arm will be the color of the player's real arms
1814 Color = BrickColor.new("Pastel brown"); --This is what the color of the fake arms will be if realBodyColor is false
1815 };
1816
1817
1818 unAimedC1 = { --This table contains the CFrames of welds when the gun is not aimed
1819 leftArm = CFrame.new(-0.7, 1.6, -0.8) * CFrame.Angles(math.rad(-10), 0, math.rad(-30));
1820 rightArm = CFrame.new(0.4, 0.25, -0.3) * CFrame.Angles(0, 0, math.rad(25));
1821 Grip = CFrame.Angles(0, math.rad(25), 0);
1822 };
1823 aimedC1 = { --This table contains the CFrames of welds when the gun is aimed
1824 leftArm = CFrame.new(-0.1, 1, -0.3) * CFrame.Angles(math.rad(-10), 0, 0) * CFrame.Angles(0, 0, math.rad(-40));
1825 rightArm = CFrame.new(0.5, 0.3, 0.1) * CFrame.Angles(0, 0, math.rad(45));
1826 };
1827 runningC1 = { --This table contains the CFrames of welds when you're running
1828 leftArm = CFrame.new(-0.65, 0.85, -1) * CFrame.Angles(math.rad(1), math.rad(-8.5), math.rad(16));
1829 rightArm = CFrame.new(0.16, 1, -0.14) * CFrame.Angles(math.rad(15), math.rad(2), math.rad(50));
1830 Grip = CFrame.Angles(0, math.rad(-5), 0);
1831 };
1832
1833
1834 equipAnimation = true; --This is whether or not an equipping animation will play when you equip the gun
1835 equipSettings = {
1836 Time = 0.25; --This is how long it takes for the equip animation to play
1837 leftArmC1 = CFrame.new(0.2, 1.2, 0) * CFrame.Angles(math.rad(105), math.rad(-30), math.rad(90)); --This is the left arm C1 when you equip the gun
1838 rightArmC1 = CFrame.new(-0.5, 0.75, 0) * CFrame.Angles(math.rad(45), 0, math.rad(75)); --This is the right arm C1 when you equip the gun
1839 GripC1 = CFrame.new(); --This is the C1 of the grip when you equip the gun
1840 };
1841
1842
1843 stopAnimsOnFall = true; --This is whether or not the movement animation will stop when you're falling
1844 fallAnimation = true; --This is whether or not there will be animation for falling and landing
1845 fallSettings = {
1846 maxDist = 35; --This is the cut off fall distance for the landing animation. If you fall any farther it'll be treated as if you fell this distance
1847 landMultiplier = 1; --This is how far the arms go down and rotate when you land. The larger the number the bigger the effect of the animation
1848 fallMultiplier = 1; --This is how far the arms go up and rotate when you fall. The larger the number the bigger the effect of the animation
1849 aimEffect = 0.25; --[[This is how many times of an effect the falling and landing animation has when you're aimed. The smaller the number the lesser
1850 the effect]]
1851 };
1852
1853
1854 gunMomentum = true; --This is whether or not there will be a gun swaying animation for when you move your mouse around
1855 momentumSettings = {
1856 maxInput = 18; --This is the maximum mouse delta that will be used as input for the sway
1857 Speed = 20; --This is the speed of the gun momentum
1858 Damper = 0.5; --[[This is the dampening effect of the gun momentum. NOTE: This number must be between 0 and 1, 0 being forever swaying and 1 being
1859 instant dampening]]
1860 Amplitude = { --These are the amplitudes of the gun momentum
1861 unAimed = 5;
1862 Aimed = 1;
1863 }
1864 };
1865
1866
1867 cockingAnim = true; --This is whether or not a cocking animation will play between every shot (for shotguns and bolt action guns)
1868 movementAnims = true; --This is whether or not the player will have movement animations
1869
1870
1871 canADS = true; --This is whether or not the gun can ADS
1872 aimSettings = {
1873 Anim = true; --This is whether or not there is an animation for aiming down the sights
1874 Speed = 0.4; --This is how long the gun will take to fully aim down the sights
1875 FOV = 10; --This is the FOV that the Camera will have when the gun is fully aimed down
1876 holdToADS = true; --This is whether or not you have to hold the right mouse or the ADS key to ADS
1877 headTilt = math.rad(25); --This is what angle the head tilts at when you ADS
1878 };
1879
1880
1881 sensitivitySettings = {
1882 Default = 1; --This is what the sensitivity of the mouse will be when the gun is not aimed. 1 is the default
1883 Aim = 0.05; --[[This is what the sensitivity of the mouse will be when the gun is aimed. The smaller the MaxZoom,
1884 the smaller the sensitivity should be (i.e. Scoped guns should have a sensitivity of around 0.2 or less]]
1885
1886 scrollToChange = true; --This is whether or not scrolling the mouse changes the aim sensitivity
1887 Min = 0.05; --This is the lowest the sensitivity can be
1888 Max = 1; --This is the highest the sensitivity can be
1889 Increment = 0.05; --This is what the increment for the sensitivity is when you scroll
1890 };
1891
1892
1893 guiScope = true; --This is whether or not your Scope will be a gui instead of a normal sight
1894 scopeSettings = {
1895 Frequency = { --This is the how fast the camera sway is. The larger the number the faster the camera moves
1896 Idling = 0.2; --This is the frequency when you're idling
1897 Walking = 0.5; --This is the frequency when you're walking
1898 };
1899 Amplitude = { --This is the how wide the camera sway is. The larger the number the wider the sway
1900 Idling = 0.75; --This is the amplitude when you're idling
1901 Walking = 0.75; --This is the amplitude when you're walking
1902 };
1903 steadyTime = 8; --This is how long you can hold your breath to steady the scope
1904 breathTime = 5; --This is how long it takes to fully retake your breath
1905 camSwayOnBreath = 2.5; --This is what the cam sway multiplier will be when you start your retake your breath
1906 unSteadyOnFire = true; --This is whether or not the camera will become unsteady when you fire the gun
1907 };
1908
1909
1910 roundsPerMin = 41; --This is how many bullets per minute the gun will fire
1911
1912
1913 bulletSettings = {
1914 instantHit = true; --[[This is whether or not the bullet will hit a target instantly. If it is false, the bullet will travel at a
1915 specific speed till it hits a target]]
1916 Range = 1800; --This is how far the bullet will travel in studs before it is no longer effective
1917 Velocity = 853; --This is how fast the bullet will travel in studs per second
1918 Acceleration = 196.2; --This is the bullet's acceleration downward (196.2 is normal roblox gravity)
1919 Color = BrickColor.new("Bright red"); --This is the color of the bullet
1920 Transparency = 0; --This is the transparency of the bullet
1921 Size = Vector3.new(0.1, 0.1, 5); --This is how big the bullet will look
1922 };
1923
1924
1925 damageSettings = {
1926 --[[The start and end damages are basically a representation of this: http://goo.gl/SiWaTj, which is a basically a graph showing the starting damage
1927 value for the gun at a distance percent from 0 to 100 and the ending damage value for the gun at a distance percent from 0 to 100. Before the bullet
1928 hits the starting distance percent, the damage is the starting damage. Once it goes past the starting distance percent, it steadily drops til it hits
1929 the ending damage. After the ending damage percent, it'll stay that damage.]]
1930 Start = {
1931 Damage = 100; --The starting damage
1932 Dist = 0.5; --[[A value between 0 and 1 which represents the distance percent. So if the bullet range is 1000 studs and this value is 0.5, then
1933 the damage will be the starting damage until the bullet travels 0.5*1000 studs or 500 studs]]
1934 };
1935 End = {
1936 Damage = 59; --The ending damage
1937 Dist = 0.5; --A value between 0 and 1 which represents the distance percent for the ending damage
1938 };
1939 Multipliers = { --[[These are the damage multipliers. There's a spread of +0.1. That means that if the multiplier is 1, the actual
1940 multiplier will range from 1 - 1.1]]
1941 Chest = 1.1; --This is what the damage will be multiplied by if the bullet hits the chest
1942 Head = 2; --This is what the damage will be multiplied by if the bullet hits the head or a hat
1943 Limbs = 1.1; --This is what the damage will be multiplied by if the bullet hits a limb (Arms or legs)
1944 };
1945 };
1946
1947
1948 AllowFriendlyFire = false; --This is whether or not you can damage teammates
1949 CanDamageNPCs = true; --This is whether or not you can damage NPC's (Zombies, fake players, anything with a humanoid)
1950
1951
1952 CanKnife = true; --This is whether or not you can knife
1953 AutoKnife = false; --This is whether or not the gun will automatically knife if an enemy is within a specific distance
1954 AutoKnifeDist = 4; --This is how many studs away an enemy has to be for the gun to auto knife
1955 KnifeMeshId = "http://www.roblox.com/asset/?id=121944778"; --This is the Mesh of the knife
1956 KnifeTextureId = "http://www.roblox.com/asset/?id=121944805"; --This is the Texture of the knife
1957 KnifeCooldown = 0.5; --This is how long you have to wait before you can knife again
1958 KnifeAnim = 1; --This is the type of knife animation
1959 --[[
1960 Type 1: An animation that swings a knife from the left of the body to the right of the body
1961 Type 2: An animation that stabs the knife forward from the center of the body
1962 --]]
1963
1964
1965 Throwables = true; --This is whether or not you have grenades
1966 TrajectoryAssist = true; --This is whether or not the script will show you the flight path of the grenade before you throw it
1967 DetonationTime = 2; --[[This is how long the grenade will wait to detonate (If DetonateOnHit is false, this is how long the
1968 grenade will wait after the pin is pulled. If true, this is how long the grenade will wait after it hits something]]
1969 TimerStartOnHit = false; --This is whether or not the timer will start when the grenade hits something
1970 GrenadeSize = Vector3.new(0.8, 0.8, 0.8); --This is the size of the grenade (Doesn't apply to throwing knives)
1971
1972
1973 LethalGrenadeColor = BrickColor.new("Bright green"); --This is the color of the lethal grenade
1974 GrenadeBlastRadius = 20; --This is the blast radius of the explosion (Doesn't apply to non-explosive grenades)
1975 GrenadeBlastPressure = 6e5; --This is what the blast pressure of the explosion (Doesn't apply to non-explosive grenades)
1976 GrenadeExplosionType = Enum.ExplosionType.NoCraters; --This is the type of explosion (Doesn't apply to non-explosive grenades)
1977 --[[
1978 (0 or "NoCraters" or Enum.ExplosionType.NoCraters) means that the explosion will not damage terrain
1979 (1 or "Craters" or Enum.ExplosionType.Craters) means that the explosion will leave craters in terrain
1980 (2 or "CratersAndDebris" or Enum.ExplosionType.CratersAndDebris) means that the explosion will leave craters and debris in terrain
1981 --]]
1982 LethalAnimationTime = 1.5; --This is how long the throwing animation for the lethal will take
1983 LethalGrenadeDamage = 150; --This is max damage that the grenade will do
1984 LethalGrenadeThrowVelocity = 200; --This is the speed at which the lethal grenade is thrown
1985 GrenadeRayCastExplosions = true; --[[This is whether or not grenade explosions will have raycasting. If this is true, humanoids
1986 behind walls won't be damaged. If this is false, any humanoid within the radius will be damaged. (NOTE: GrenadeRangeBasedDamage
1987 has to be true in order for explosions to have raycasting)]]
1988 GrenadeRangeBasedDamage = true; --[[This is whether or not will depend on how far the object is from the center of the explosion.
1989 If this is true, the farther a humanoid is from the blast center, the less damage it'll take. If this is false, any object
1990 within the explosion's radius will have its joints broken]]
1991 LethalGrenadeType = 1; --This is the lethal grenade type
1992 --[[
1993 Type 1: Frag grenade [An explosive grenade]
1994 Type 2: Sticky [An explosive grenade that sticks to a surface]
1995 Type 3: Throwing Knife [A throwable knife]
1996 Type 4: Molotov [A grenade that explodes in flames on impact]
1997 --]]
1998
1999 TacticalGrenadeColor = BrickColor.new("Brick yellow"); --This is the color of the lethal grenade
2000 TacticalAnimationTime = 1.5; --This how long the throwing animation for the tactical will take
2001 TacticalGrenadeThrowVelocity = 200; --This is the speed at which the tactical grenade is thrown
2002 GrenadeEffectRadius = 70; --[[This is the radius of the effect of the grenade. If the Grenade is a smoke, this is the radius of
2003 the smoke]]
2004 GrenadeEffectTime = 10; --[[This is the how long the grenade effect will last. If the grenade is a smoke, this is how long the
2005 smoke will linger]]
2006 TacticalGrenadeType = 1; --This is the tactical grenade type
2007 --[[
2008 Type 1: Smoke grenade [A grenade that creates a cloud of smoke]
2009 Type 2: Flashbang [A grenade that temporarily blinds and deafens players]
2010 --]]
2011
2012
2013 GrenadeTrail = true; --This is whether or not the grenade will have a trail
2014 GrenadeTrailColor = BrickColor.new("Black"); --This is the color of the grenade trail
2015 GrenadeTrailTransparency = 0.6; --This is the transparency of the trail
2016 GrenadeTrailThickness = 0.3; --This is the thickness of the trail
2017 GrenadeTrailVisibleTime = 0.2; --This is how long the trail will be visible for
2018 GrenadeTrailDisappearTime = 0.2; --This is how long it will take for the trail to disappear
2019
2020
2021 bulletTrail = false; --This is whether or not there will be a trail behind the bullet
2022 trailSettings = {
2023 Color = BrickColor.new("White"); --This is the color of the bullet trail
2024 Transparency = 0.6; --This is the transparency of the trail
2025 Thickness = 0.2; --This is the thickness of the trail
2026 visibleTime = 0; --This is how long the trail will be visible for
2027 disappearTime = 0.5; --This is how long it will take for the trail to disappear
2028 };
2029
2030
2031 bulletHoles = true; --This is whether or not bullet holes will appear where you shot
2032 holeSettings = {
2033 Texture = "http://www.roblox.com/asset/?id=64291961"; --This is the texture of the bullet hole
2034 Size = 0.5; --This is how big the bullet hole will be in studs
2035 visibleTime = 3; --This is how long the bullet hole will be visible for
2036 disappearTime = 1; --This is how long it will take for the bullet hole to disappear
2037 };
2038
2039
2040 bulletSparks = true; --This is whether or not sparks will fly when a bullet hits a surface
2041 sparkSettings = {
2042 Color = Color3.new(1, 1, 127 / 255); --This is the color of the sparks
2043 Size = 0.075; --This is the size of the sparks
2044 Texture = "http://www.roblox.com/asset/?id=3419963"; --This is the texture of the sparks
2045 Lifetime = 0.2; --This is the lifetime of each spark in seconds +-0.05 seconds
2046 Rate = 150; --This is the number of sparks that fly
2047 Speed = 45; --This is the speed at which the sparks fly +-5 studs/sec
2048 Spread = 45; --This is the angle in degrees at which the sparks spread out (0 means single line, 180 means all around)
2049 Materials = { --This is the list of the materials which cause bullet sparks. You can add or remove materials from this list
2050 Enum.Material.Plastic;
2051 Enum.Material.Slate;
2052 Enum.Material.Concrete;
2053 Enum.Material.CorrodedMetal;
2054 Enum.Material.DiamondPlate;
2055 Enum.Material.Foil;
2056 Enum.Material.Marble;
2057 Enum.Material.Granite;
2058 Enum.Material.Brick;
2059 Enum.Material.Pebble;
2060 Enum.Material.SmoothPlastic;
2061 Enum.Material.Metal;
2062 Enum.Material.Cobblestone;
2063 };
2064 };
2065
2066
2067 bulletSmoke = true; --This is whether or not smoke particles will fly when a bullet hits a surface
2068 smokeSettings = {
2069 objColor = true; --This is whether or not the smoke color will be the color of the object the bullet hit
2070 Color = Color3.new(0.5, 0.5, 0.5); --This is what the color of the smoke will be if objColor is false
2071 Size = {
2072 Start = 0.25; --This is what the starting size of the smoke will be
2073 End = 0.5; --This is what the ending size of the smoke will be
2074 };
2075 Texture = "http://www.roblox.com/asset/?id=244514423"; --This is what the texture of the smoke will be
2076 startTransparency = 0; --This is what the transparency of the particle starts at. It gradually goes to 1
2077 Lifetime = 0.2; --This is the lifetime of each smoke particle +-0.05 seconds
2078 Rate = 100; --This is the number of smoke particles that fly
2079 Speed = 35; --This is the speed at which the smoke particles fly +-5 studs/sec
2080 Spread = 15; --This is the angle in degrees at which the smoke particles spread out (0 means single line, 180 means all around)
2081 };
2082
2083
2084 bloodEffect = true; --This is whether or not blood particles will appear from the bullet exit position when a humanoid is shot
2085 bloodSettings = {
2086 Color = Color3.new(1, 0, 0); --This is what the color of the blood will be
2087 Size = 0.1; --This is what the size of the blood will be with an +-0.1
2088 Texture = "http://www.roblox.com/asset/?id=3419963"; --This is what the texture of the blood will be
2089 startTransparency = 0.125; --This is what the starting transparency of the blood will be +-0.125
2090 Lifetime = 0.1; --This is what the lifetime of each blood particle +-0.05 seconds
2091 Rate = 200; --This is the number of blood particles that appear
2092 Speed = 50; --This is the speed at which the blood particles fly
2093 Spread = 15; --This is the angle in degrees at which the blood particles spread out (0 means single line, 180 means all around)
2094 };
2095
2096
2097 bulletShockwave = true; --This is whether or not a shockwave will appear where you shot. (A sphere that appears when the bullet hits)
2098 shockwaveSettings = {
2099 Radius = 0.3; --This is the radius of the shockwave. (If the gun type is explosion, this radius will be the blast radius)
2100 Color = BrickColor.new("Light stone grey"); --This is the color of the shockwave
2101 Duration = 0.2; --This is how long the shockwave will take to disappear
2102 };
2103
2104
2105 penetrationSettings = {
2106 Dist = 5; --This is the maximum amount of studs a bullet can penetrate into a wall (that isn't ignored)
2107 transparencyThreshold = 1; --This is what the transparency of a wall has to be greater than or equal to in order to be ignored
2108 ignoreNonCanCollide = true; --This is whether or not the script should ignore non-cancollide parts
2109 ignoreCustom = {}; --This is a table of objects that will be ignored by the script. The object and it's descendants will be ignored
2110 };
2111
2112
2113 recoilSettings = {
2114 firstShotMultiplier = 1; --This is what the recoil multiplier for the first shot will be. The rest of the shots will be normal recoil
2115 aimedMultiplier = 0.5; --When you're aimed, this is what the recoil will be multiplied by
2116 camMultiplier = 2.5; --This is what the gun up recoil will be multiplied by to get you the cam recoil
2117 springSpeed = 15; --This is the what the speed of the gun's recoil spring will be. The lower it is the slower the gun sways around
2118 springDamper = 0.5; --This is a number between 0 and 1 that determines how quickly the spring will be dampened.
2119 Recoil = {
2120 Side = { --This is the side to side gun and camera recoil
2121 Left = -0.1;
2122 Right = 0.3;
2123 };
2124 Up = { --This is the up and down gun and camera recoil
2125 Min = 1.9;
2126 Max = 2;
2127 };
2128 Back = { --[[This is the kick back gun recoil. NOTE: The numbers below are the amount the gun moves back, so the gun will move back
2129 a value/2 amount of studs. So if the min is 0.25 and the max is 0.3, the gun will move back anywhere between 0.025 and 0.03 studs]]
2130 Min = 0.4;
2131 Max = 0.45;
2132 };
2133 Tilt = { --[[This is tilt camera recoil. NOTE: The numbers below are the amount of deca-degrees the camera tilts, so if the left is -1
2134 and the right is 1 then the gun will tilt anywhere between -10 degress and 10 degrees]]
2135 Left = -0.5;
2136 Right = 0.5;
2137 };
2138 }
2139 };
2140
2141
2142 spreadSettings = {
2143 Increase = 0.3; --This is what is added to the spread of the bullet every time you fire
2144 Decrease = 15; --This is what the spread of the bullet decreases by per second
2145
2146 --[[This spread values are how many degrees offset the bullets will travel from the center, so a spread of 1 would mean that the bullet's
2147 max spread in any direction is 1 degree from the center. The idling category is when you're not moving, and the moving category is when
2148 you're moving]]
2149 Aimed = {
2150 Stand = {
2151 Idling = 0;
2152 Moving = 0;
2153 };
2154 Crouch = {
2155 Idling = 0;
2156 Moving = 0;
2157 };
2158 Prone = {
2159 Idling = 0;
2160 Moving = 0;
2161 };
2162 };
2163 unAimed = {
2164 Stand = {
2165 Idling = 1.5;
2166 Moving = 3.5;
2167 };
2168 Crouch = {
2169 Idling = 2.5;
2170 Moving = 4;
2171 };
2172 Prone = {
2173 Idling = 1.5;
2174 Moving = 4;
2175 };
2176 };
2177 };
2178
2179
2180 reloadSettings = {
2181 Anim = true; --This is whether or not there is an animation for reloading
2182 Times = {
2183 Loaded = 2.036; --This is how long it takes to reload the gun if a bullet is already chambered
2184 Empty = 2.036; --This is how long it takes to reload the gun if a bullet isn't chambered
2185 };
2186 autoReload = true; --This is whether or not the gun will reload automatically when the ammo reaches 0
2187 magIsBullet = false; --This is whether or not the mag is the bullet itself. This is useful for guns with only 1 bullet per clip
2188 reloadWhileRunning = true; --This is whether or not you can reload while running
2189 };
2190
2191
2192 sprintTime = 15; --This is the maximum time you can sprint
2193 staminaCoolTime = 4; --This is how long it takes for your stamina to fully recharge
2194 canFireWhileRunning = false; --This is whether or not you can shoot while sprinting
2195
2196
2197 dolphinDive = true; --This is whether or not you can dolphin dive (Run and crouch at the same time to dive)
2198 diveSettings = {
2199 rechargeTime = 1; --This is how long you have to wait till you can dive or run again after you've dived
2200 Force = 750; --This is the multiplier for the dolphin dive force. The higher it is the farther you'll dive
2201 Angle = math.rad(30); --This is the angle in radians from the ground that you dive at
2202 };
2203
2204
2205 canChangeStance = true; --This is whether or not you can change stance. That means whether or not you can crouch or go prone
2206 stanceSettings = {
2207 Anim = true; --This is whether or not there is an animation for changing stance
2208 Speed = 0.3; --This is how quickly you change stance
2209 Stances = {
2210 Crouch = true; --This is whether or not you can crouch
2211 Prone = true; --This is whether or not you can go prone
2212 };
2213 standOnDeselect = true; --This is whether or not you stand up when you deselect the tool
2214 crawlAnimation = true; --This is whether or not you crawl while moving when you're prone
2215 };
2216
2217
2218 walkSpeeds = {
2219 Base = 14; --This is the base walkspeed
2220 Sprinting = 25; --This is the walkspeed when you're sprinting
2221 Aimed = 7; --[[This is the base walkspeed when the gun is aimed down. If you crouch or go prone, the speed will change
2222 based on the Aimed walkspeed to Base walkspeed ratio]]
2223 Crouched = 6; --This is the walkspeed when you're crouched
2224 Prone = 3; --This is the walkspeed when you're prone
2225 };
2226
2227
2228 --NOTE: For extra keys, go here: http://wiki.roblox.com/index.php?title=Taking_keyboard_input
2229 Keys = {
2230 lowerStance = "c"; --This is the key you press to lower your stance (Stand > Crouch > Prone)
2231 raiseStance = "x"; --This is the key you press to raise your stance (Prone > Crouch > Stand)
2232 selectFire = "e"; --This is the key you press to switch fire modes
2233 Reload = "r"; --This is the key you press to reload
2234 Sprint = string.char(48); --This is the key you press to sprint
2235 Knife = "f"; --This is the key you press to knife
2236 lethalGrenade = "g"; --This is the key you press to throw the lethal grenade
2237 tacticalGrenade = "t"; --This is the key you press to throw the tactical grenade
2238 ADS = "q"; --This is the key you press to ADS. If you want ADS to just be right mouse, then make this key ""
2239 scopeSteady = string.char(48); --This is the key you press to steady the scope
2240 };
2241
2242
2243}
2244
2245return Settings
2246end))
2247MeshPart126.Name = "BoltBack"
2248MeshPart126.Parent = Tool0
2249MeshPart126.CFrame = CFrame.new(14.7282362, 1.11425996, 59.2552185, -0.0165403951, -4.79709706e-06, -0.9998703, 7.03719252e-07, 1.00000429, -4.8072543e-06, 0.999872565, -7.97581208e-07, -0.0165404305)
2250MeshPart126.Orientation = Vector3.new(0, -90.9499969, 0)
2251MeshPart126.Position = Vector3.new(14.7282362, 1.11425996, 59.2552185)
2252MeshPart126.Rotation = Vector3.new(179.979996, -89.0800018, 179.979996)
2253MeshPart126.Color = Color3.new(0.105882, 0.164706, 0.207843)
2254MeshPart126.Transparency = 1
2255MeshPart126.Size = Vector3.new(0.225147113, 0.225146979, 1.33002651)
2256MeshPart126.Anchored = true
2257MeshPart126.BrickColor = BrickColor.new("Black")
2258MeshPart126.CanCollide = false
2259MeshPart126.Material = Enum.Material.Metal
2260MeshPart126.brickColor = BrickColor.new("Black")
2261MeshPart126.TextureID = "rbxassetid://1888432391"
2262MeshPart127.Name = "BoltBack"
2263MeshPart127.Parent = Tool0
2264MeshPart127.CFrame = CFrame.new(14.2968521, 1.20650804, 59.4371185, -0.47917518, -0.0654681399, -0.875274301, 0.820054293, 0.322098225, -0.473036677, 0.312893122, -0.944439888, -0.100654036)
2265MeshPart127.Orientation = Vector3.new(28.2299995, -96.5599976, 68.5599976)
2266MeshPart127.Position = Vector3.new(14.2968521, 1.20650804, 59.4371185)
2267MeshPart127.Rotation = Vector3.new(102.010002, -61.0800018, 172.220001)
2268MeshPart127.Color = Color3.new(0.105882, 0.164706, 0.207843)
2269MeshPart127.Transparency = 1
2270MeshPart127.Size = Vector3.new(0.433685064, 0.231282279, 0.225147024)
2271MeshPart127.Anchored = true
2272MeshPart127.BrickColor = BrickColor.new("Black")
2273MeshPart127.CanCollide = false
2274MeshPart127.Material = Enum.Material.Metal
2275MeshPart127.brickColor = BrickColor.new("Black")
2276MeshPart127.TextureID = "rbxassetid://1888432391"
2277MeshPart128.Name = "Bolt"
2278MeshPart128.Parent = Tool0
2279MeshPart128.CFrame = CFrame.new(14.9882402, 1.11425996, 59.2552185, -0.0165403951, -4.79709706e-06, -0.9998703, 7.03719252e-07, 1.00000429, -4.8072543e-06, 0.999872565, -7.97581208e-07, -0.0165404305)
2280MeshPart128.Orientation = Vector3.new(0, -90.9499969, 0)
2281MeshPart128.Position = Vector3.new(14.9882402, 1.11425996, 59.2552185)
2282MeshPart128.Rotation = Vector3.new(179.979996, -89.0800018, 179.979996)
2283MeshPart128.Color = Color3.new(0.105882, 0.164706, 0.207843)
2284MeshPart128.Size = Vector3.new(0.225147113, 0.225146979, 1.33002651)
2285MeshPart128.Anchored = true
2286MeshPart128.BrickColor = BrickColor.new("Black")
2287MeshPart128.CanCollide = false
2288MeshPart128.Material = Enum.Material.Metal
2289MeshPart128.brickColor = BrickColor.new("Black")
2290MeshPart128.TextureID = "rbxassetid://1888432391"
2291Part129.Name = "AimPart"
2292Part129.Parent = Tool0
2293Part129.CFrame = CFrame.new(13.1878405, 1.49022305, 59.2290459, 2.56274006e-06, -1.58414892e-07, -0.999994576, 2.07748656e-07, 0.999994755, -1.58414338e-07, 0.999999881, -2.07749366e-07, 2.53294024e-06)
2294Part129.Orientation = Vector3.new(0, -90, 0)
2295Part129.Position = Vector3.new(13.1878405, 1.49022305, 59.2290459)
2296Part129.Rotation = Vector3.new(3.57999992, -89.8099976, 3.53999996)
2297Part129.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
2298Part129.Transparency = 1
2299Part129.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
2300Part129.Anchored = true
2301Part129.BackSurface = Enum.SurfaceType.SmoothNoOutlines
2302Part129.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
2303Part129.BrickColor = BrickColor.new("Really black")
2304Part129.CanCollide = false
2305Part129.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
2306Part129.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
2307Part129.Material = Enum.Material.SmoothPlastic
2308Part129.Reflectance = 0.10000000149012
2309Part129.RightSurface = Enum.SurfaceType.SmoothNoOutlines
2310Part129.TopSurface = Enum.SurfaceType.SmoothNoOutlines
2311Part129.brickColor = BrickColor.new("Really black")
2312Part129.FormFactor = Enum.FormFactor.Custom
2313Part129.formFactor = Enum.FormFactor.Custom
2314Part130.Name = "Handle"
2315Part130.Parent = Tool0
2316Part130.CFrame = CFrame.new(14.6438541, 0.528231978, 59.2650414, 2.56274006e-06, -1.58414892e-07, -0.999994576, 2.07748656e-07, 0.999994755, -1.58414338e-07, 0.999999881, -2.07749366e-07, 2.53294024e-06)
2317Part130.Orientation = Vector3.new(0, -90, 0)
2318Part130.Position = Vector3.new(14.6438541, 0.528231978, 59.2650414)
2319Part130.Rotation = Vector3.new(3.57999992, -89.8099976, 3.53999996)
2320Part130.Color = Color3.new(1, 0.690196, 0)
2321Part130.Transparency = 1
2322Part130.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
2323Part130.Anchored = true
2324Part130.BackSurface = Enum.SurfaceType.SmoothNoOutlines
2325Part130.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
2326Part130.BrickColor = BrickColor.new("Deep orange")
2327Part130.CanCollide = false
2328Part130.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
2329Part130.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
2330Part130.Material = Enum.Material.SmoothPlastic
2331Part130.RightSurface = Enum.SurfaceType.SmoothNoOutlines
2332Part130.TopSurface = Enum.SurfaceType.SmoothNoOutlines
2333Part130.brickColor = BrickColor.new("Deep orange")
2334Part130.FormFactor = Enum.FormFactor.Custom
2335Part130.formFactor = Enum.FormFactor.Custom
2336BlockMesh131.Parent = Part130
2337BlockMesh131.Scale = Vector3.new(0.239999995, 0.120000005, 0.119999997)
2338Sound132.Name = "FireSound"
2339Sound132.Parent = Part130
2340Sound132.Pitch = 1.0199999809265
2341Sound132.PlaybackSpeed = 1.0199999809265
2342Sound132.SoundId = "http://www.roblox.com/asset/?id=252126882"
2343Sound132.Volume = 1
2344Sound133.Name = "ReloadSound"
2345Sound133.Parent = Part130
2346Sound133.SoundId = "rbxassetid://142491708"
2347Camera134.Name = "ThumbnailCamera"
2348Camera134.Parent = Tool0
2349Camera134.CFrame = CFrame.new(-20.3689098, 1.1051302, -16.8431301, -0.667975783, 0.176884323, 0.722855628, -7.45058149e-09, 0.971341193, -0.237689286, -0.744183004, -0.15877068, -0.648832381)
2350Camera134.CoordinateFrame = CFrame.new(-20.3689098, 1.1051302, -16.8431301, -0.667975783, 0.176884323, 0.722855628, -7.45058149e-09, 0.971341193, -0.237689286, -0.744183004, -0.15877068, -0.648832381)
2351Camera134.FieldOfView = 40
2352Camera134.Focus = CFrame.new(-21.814621, 1.58050871, -15.5454655, 1, 0, 0, 0, 1, 0, 0, 0, 1)
2353Camera134.focus = CFrame.new(-21.814621, 1.58050871, -15.5454655, 1, 0, 0, 0, 1, 0, 0, 0, 1)
2354for i,v in pairs(mas:GetChildren()) do
2355 v.Parent = script
2356 pcall(function() v:MakeJoints() end)
2357end
2358mas:Destroy()
2359for i,v in pairs(cors) do
2360 spawn(function()
2361 pcall(v)
2362 end)
2363end
2364
2365function sandbox(var,func)
2366 local env = getfenv(func)
2367 local newenv = setmetatable({},{
2368 __index = function(self,k)
2369 if k=="script" then
2370 return var
2371 else
2372 return env[k]
2373 end
2374 end,
2375 })
2376 setfenv(func,newenv)
2377 return func
2378end
2379cors = {}
2380mas = Instance.new("Model",game:GetService("Lighting"))
2381Tool0 = Instance.new("Tool")
2382MeshPart1 = Instance.new("MeshPart")
2383Part2 = Instance.new("Part")
2384BlockMesh3 = Instance.new("BlockMesh")
2385ParticleEmitter4 = Instance.new("ParticleEmitter")
2386ParticleEmitter5 = Instance.new("ParticleEmitter")
2387PointLight6 = Instance.new("PointLight")
2388MeshPart7 = Instance.new("MeshPart")
2389Decal8 = Instance.new("Decal")
2390Decal9 = Instance.new("Decal")
2391Decal10 = Instance.new("Decal")
2392MeshPart11 = Instance.new("MeshPart")
2393MeshPart12 = Instance.new("MeshPart")
2394MeshPart13 = Instance.new("MeshPart")
2395UnionOperation14 = Instance.new("UnionOperation")
2396MeshPart15 = Instance.new("MeshPart")
2397IntValue16 = Instance.new("IntValue")
2398IntValue17 = Instance.new("IntValue")
2399IntValue18 = Instance.new("IntValue")
2400IntValue19 = Instance.new("IntValue")
2401IntValue20 = Instance.new("IntValue")
2402Script21 = Instance.new("Script")
2403Script22 = Instance.new("Script")
2404ObjectValue23 = Instance.new("ObjectValue")
2405RemoteFunction24 = Instance.new("RemoteFunction")
2406RemoteFunction25 = Instance.new("RemoteFunction")
2407RemoteFunction26 = Instance.new("RemoteFunction")
2408RemoteEvent27 = Instance.new("RemoteEvent")
2409RemoteFunction28 = Instance.new("RemoteFunction")
2410RemoteFunction29 = Instance.new("RemoteFunction")
2411RemoteFunction30 = Instance.new("RemoteFunction")
2412LocalScript31 = Instance.new("LocalScript")
2413IntValue32 = Instance.new("IntValue")
2414RemoteEvent33 = Instance.new("RemoteEvent")
2415RemoteEvent34 = Instance.new("RemoteEvent")
2416RemoteEvent35 = Instance.new("RemoteEvent")
2417RemoteEvent36 = Instance.new("RemoteEvent")
2418LocalScript37 = Instance.new("LocalScript")
2419IntValue38 = Instance.new("IntValue")
2420Folder39 = Instance.new("Folder")
2421ModuleScript40 = Instance.new("ModuleScript")
2422ModuleScript41 = Instance.new("ModuleScript")
2423ScreenGui42 = Instance.new("ScreenGui")
2424ImageLabel43 = Instance.new("ImageLabel")
2425NumberValue44 = Instance.new("NumberValue")
2426Frame45 = Instance.new("Frame")
2427ImageLabel46 = Instance.new("ImageLabel")
2428TextLabel47 = Instance.new("TextLabel")
2429Frame48 = Instance.new("Frame")
2430TextLabel49 = Instance.new("TextLabel")
2431Frame50 = Instance.new("Frame")
2432TextLabel51 = Instance.new("TextLabel")
2433Frame52 = Instance.new("Frame")
2434TextLabel53 = Instance.new("TextLabel")
2435Frame54 = Instance.new("Frame")
2436TextLabel55 = Instance.new("TextLabel")
2437Frame56 = Instance.new("Frame")
2438Frame57 = Instance.new("Frame")
2439TextLabel58 = Instance.new("TextLabel")
2440TextLabel59 = Instance.new("TextLabel")
2441TextLabel60 = Instance.new("TextLabel")
2442TextLabel61 = Instance.new("TextLabel")
2443TextLabel62 = Instance.new("TextLabel")
2444Frame63 = Instance.new("Frame")
2445TextLabel64 = Instance.new("TextLabel")
2446TextLabel65 = Instance.new("TextLabel")
2447TextLabel66 = Instance.new("TextLabel")
2448Frame67 = Instance.new("Frame")
2449TextLabel68 = Instance.new("TextLabel")
2450Frame69 = Instance.new("Frame")
2451Frame70 = Instance.new("Frame")
2452Frame71 = Instance.new("Frame")
2453Frame72 = Instance.new("Frame")
2454Frame73 = Instance.new("Frame")
2455Frame74 = Instance.new("Frame")
2456Frame75 = Instance.new("Frame")
2457Frame76 = Instance.new("Frame")
2458Frame77 = Instance.new("Frame")
2459Frame78 = Instance.new("Frame")
2460Frame79 = Instance.new("Frame")
2461Frame80 = Instance.new("Frame")
2462Frame81 = Instance.new("Frame")
2463Frame82 = Instance.new("Frame")
2464Frame83 = Instance.new("Frame")
2465Frame84 = Instance.new("Frame")
2466Frame85 = Instance.new("Frame")
2467Frame86 = Instance.new("Frame")
2468Frame87 = Instance.new("Frame")
2469Frame88 = Instance.new("Frame")
2470Frame89 = Instance.new("Frame")
2471Frame90 = Instance.new("Frame")
2472Frame91 = Instance.new("Frame")
2473Frame92 = Instance.new("Frame")
2474Frame93 = Instance.new("Frame")
2475Frame94 = Instance.new("Frame")
2476TextLabel95 = Instance.new("TextLabel")
2477TextLabel96 = Instance.new("TextLabel")
2478Frame97 = Instance.new("Frame")
2479Frame98 = Instance.new("Frame")
2480ImageLabel99 = Instance.new("ImageLabel")
2481TextLabel100 = Instance.new("TextLabel")
2482TextLabel101 = Instance.new("TextLabel")
2483Frame102 = Instance.new("Frame")
2484ImageLabel103 = Instance.new("ImageLabel")
2485TextLabel104 = Instance.new("TextLabel")
2486TextLabel105 = Instance.new("TextLabel")
2487Frame106 = Instance.new("Frame")
2488TextLabel107 = Instance.new("TextLabel")
2489TextLabel108 = Instance.new("TextLabel")
2490TextLabel109 = Instance.new("TextLabel")
2491Frame110 = Instance.new("Frame")
2492Frame111 = Instance.new("Frame")
2493ImageLabel112 = Instance.new("ImageLabel")
2494ImageLabel113 = Instance.new("ImageLabel")
2495Frame114 = Instance.new("Frame")
2496TextLabel115 = Instance.new("TextLabel")
2497Frame116 = Instance.new("Frame")
2498ImageLabel117 = Instance.new("ImageLabel")
2499ImageLabel118 = Instance.new("ImageLabel")
2500Frame119 = Instance.new("Frame")
2501Frame120 = Instance.new("Frame")
2502LocalScript121 = Instance.new("LocalScript")
2503TextLabel122 = Instance.new("TextLabel")
2504ModuleScript123 = Instance.new("ModuleScript")
2505ModuleScript124 = Instance.new("ModuleScript")
2506ModuleScript125 = Instance.new("ModuleScript")
2507MeshPart126 = Instance.new("MeshPart")
2508MeshPart127 = Instance.new("MeshPart")
2509MeshPart128 = Instance.new("MeshPart")
2510Part129 = Instance.new("Part")
2511Part130 = Instance.new("Part")
2512BlockMesh131 = Instance.new("BlockMesh")
2513Sound132 = Instance.new("Sound")
2514Sound133 = Instance.new("Sound")
2515Camera134 = Instance.new("Camera")
2516Tool0.Name = "AWP"
2517Tool0.Parent = mas
2518Tool0.TextureId = "rbxassetid://1888421471"
2519MeshPart1.Name = "Bolt"
2520MeshPart1.Parent = Tool0
2521MeshPart1.CFrame = CFrame.new(14.6768599, 1.02650702, 59.4171219, -0.0155412592, -0.00566160912, -0.9998703, -0.342018068, 0.939697981, -4.80789458e-06, 0.939574361, 0.341972977, -0.0165404305)
2522MeshPart1.Orientation = Vector3.new(0, -90.9499969, -20)
2523MeshPart1.Position = Vector3.new(14.6768599, 1.02650702, 59.4171219)
2524MeshPart1.Rotation = Vector3.new(179.979996, -89.0800018, 159.979996)
2525MeshPart1.Color = Color3.new(0.105882, 0.164706, 0.207843)
2526MeshPart1.Size = Vector3.new(0.433685064, 0.231282279, 0.225147024)
2527MeshPart1.Anchored = true
2528MeshPart1.BrickColor = BrickColor.new("Black")
2529MeshPart1.CanCollide = false
2530MeshPart1.Material = Enum.Material.Metal
2531MeshPart1.brickColor = BrickColor.new("Black")
2532MeshPart1.TextureID = "rbxassetid://1888432391"
2533Part2.Name = "Main"
2534Part2.Parent = Tool0
2535Part2.CFrame = CFrame.new(20.7343903, 1.16599596, 59.3347816, -2.56274029e-06, -1, 1.5084899e-07, 7.24965687e-09, 1.50848976e-07, 1, -1, 2.56274029e-06, 7.24927007e-09)
2536Part2.Orientation = Vector3.new(-90, 90, 0)
2537Part2.Position = Vector3.new(20.7343903, 1.16599596, 59.3347816)
2538Part2.Rotation = Vector3.new(-90, 0, 90)
2539Part2.Color = Color3.new(0.105882, 0.164706, 0.207843)
2540Part2.Transparency = 1
2541Part2.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
2542Part2.Anchored = true
2543Part2.BackSurface = Enum.SurfaceType.SmoothNoOutlines
2544Part2.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
2545Part2.BrickColor = BrickColor.new("Black")
2546Part2.CanCollide = false
2547Part2.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
2548Part2.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
2549Part2.RightSurface = Enum.SurfaceType.SmoothNoOutlines
2550Part2.TopSurface = Enum.SurfaceType.SmoothNoOutlines
2551Part2.brickColor = BrickColor.new("Black")
2552Part2.FormFactor = Enum.FormFactor.Custom
2553Part2.formFactor = Enum.FormFactor.Custom
2554BlockMesh3.Parent = Part2
2555BlockMesh3.Scale = Vector3.new(0.131578952, 0.0263157897, 0.131578952)
2556ParticleEmitter4.Name = "1FlashFX[Smoke]"
2557ParticleEmitter4.Parent = Part2
2558ParticleEmitter4.Speed = NumberRange.new(5, 7)
2559ParticleEmitter4.Rotation = NumberRange.new(0, 360)
2560ParticleEmitter4.Color = ColorSequence.new(Color3.new(0.27451, 0.27451, 0.27451),Color3.new(0.27451, 0.27451, 0.27451))
2561ParticleEmitter4.Enabled = false
2562ParticleEmitter4.LightEmission = 0.10000000149012
2563ParticleEmitter4.Texture = "http://www.roblox.com/asset/?id=244514423"
2564ParticleEmitter4.Transparency = NumberSequence.new(0.60000002384186,1)
2565ParticleEmitter4.Size = NumberSequence.new(0.99999964237213,3)
2566ParticleEmitter4.Lifetime = NumberRange.new(1.25, 1.5)
2567ParticleEmitter4.Rate = 100
2568ParticleEmitter4.RotSpeed = NumberRange.new(10, 10)
2569ParticleEmitter4.SpreadAngle = Vector2.new(15, 15)
2570ParticleEmitter4.VelocitySpread = 15
2571ParticleEmitter5.Name = "FlashFX[Flash]"
2572ParticleEmitter5.Parent = Part2
2573ParticleEmitter5.Speed = NumberRange.new(50, 50)
2574ParticleEmitter5.Rotation = NumberRange.new(0, 90)
2575ParticleEmitter5.Color = ColorSequence.new(Color3.new(1, 1, 0.498039),Color3.new(1, 1, 0.498039))
2576ParticleEmitter5.Enabled = false
2577ParticleEmitter5.LightEmission = 0.5
2578ParticleEmitter5.Texture = "http://www.roblox.com/asset/?id=3419963"
2579ParticleEmitter5.Transparency = NumberSequence.new(0.75,1)
2580ParticleEmitter5.Size = NumberSequence.new(0.5,0)
2581ParticleEmitter5.Lifetime = NumberRange.new(0.050000000745058, 0.075000002980232)
2582ParticleEmitter5.Rate = 1000
2583PointLight6.Name = "FlashFX[Light]"
2584PointLight6.Parent = Part2
2585PointLight6.Color = Color3.new(1, 1, 0.498039)
2586PointLight6.Enabled = false
2587PointLight6.Range = 6
2588PointLight6.Brightness = 10
2589PointLight6.Shadows = true
2590MeshPart7.Name = "Lower Body"
2591MeshPart7.Parent = Tool0
2592MeshPart7.CFrame = CFrame.new(14.7214756, 0.585657001, 59.2569847, -0.0165353101, 2.03726813e-10, -0.999860942, -5.76605999e-08, 1.00000429, 3.23052518e-09, 0.999863207, 4.32664109e-08, -0.0165353436)
2593MeshPart7.Orientation = Vector3.new(0, -90.9499969, 0)
2594MeshPart7.Position = Vector3.new(14.7214756, 0.585657001, 59.2569847)
2595MeshPart7.Rotation = Vector3.new(-180, -89.0400009, -180)
2596MeshPart7.Color = Color3.new(0.294118, 0.592157, 0.294118)
2597MeshPart7.Size = Vector3.new(0.37235868, 1.19685471, 5.1817317)
2598MeshPart7.Anchored = true
2599MeshPart7.BrickColor = BrickColor.new("Bright green")
2600MeshPart7.CanCollide = false
2601MeshPart7.Material = Enum.Material.Metal
2602MeshPart7.brickColor = BrickColor.new("Bright green")
2603MeshPart7.TextureID = "rbxassetid://1888432391"
2604Decal8.Parent = MeshPart7
2605Decal8.Face = Enum.NormalId.Left
2606Decal9.Parent = MeshPart7
2607Decal9.Face = Enum.NormalId.Right
2608Decal10.Parent = MeshPart7
2609Decal10.Face = Enum.NormalId.Top
2610MeshPart11.Name = "Mag"
2611MeshPart11.Parent = Tool0
2612MeshPart11.CFrame = CFrame.new(15.1929197, 0.592752993, 59.2411346, -0.0165403951, -4.79709706e-06, -0.9998703, 7.03719252e-07, 1.00000429, -4.8072543e-06, 0.999872565, -7.97581208e-07, -0.0165404305)
2613MeshPart11.Orientation = Vector3.new(0, -90.9499969, 0)
2614MeshPart11.Position = Vector3.new(15.1929197, 0.592752993, 59.2411346)
2615MeshPart11.Rotation = Vector3.new(179.979996, -89.0800018, 179.979996)
2616MeshPart11.Color = Color3.new(0.105882, 0.164706, 0.207843)
2617MeshPart11.Size = Vector3.new(0.225147113, 0.409502, 0.722808301)
2618MeshPart11.Anchored = true
2619MeshPart11.BrickColor = BrickColor.new("Black")
2620MeshPart11.CanCollide = false
2621MeshPart11.Material = Enum.Material.Metal
2622MeshPart11.brickColor = BrickColor.new("Black")
2623MeshPart11.TextureID = "rbxassetid://1888432391"
2624MeshPart12.Name = "Part"
2625MeshPart12.Parent = Tool0
2626MeshPart12.CFrame = CFrame.new(18.1024742, 0.973644972, 59.2947464, -0.0165353138, 2.03726813e-10, -0.999861181, -5.76605999e-08, 1.00000429, 3.23052518e-09, 0.999863446, 4.32664109e-08, -0.0165353473)
2627MeshPart12.Orientation = Vector3.new(0, -90.9499969, 0)
2628MeshPart12.Position = Vector3.new(18.1024742, 0.973644972, 59.2947464)
2629MeshPart12.Rotation = Vector3.new(-180, -89.0500031, -180)
2630MeshPart12.Color = Color3.new(0.105882, 0.164706, 0.207843)
2631MeshPart12.Size = Vector3.new(0.615788579, 0.59661901, 5.05250168)
2632MeshPart12.Anchored = true
2633MeshPart12.BrickColor = BrickColor.new("Black")
2634MeshPart12.CanCollide = false
2635MeshPart12.Material = Enum.Material.Metal
2636MeshPart12.brickColor = BrickColor.new("Black")
2637MeshPart12.TextureID = "rbxassetid://1888432391"
2638MeshPart13.Name = "Part"
2639MeshPart13.Parent = Tool0
2640MeshPart13.CFrame = CFrame.new(14.957962, 1.14786196, 59.2372627, -0.0165353138, 2.03726813e-10, -0.999861181, -5.76605999e-08, 1.00000429, 3.23052518e-09, 0.999863446, 4.32664109e-08, -0.0165353473)
2641MeshPart13.Orientation = Vector3.new(0, -90.9499969, 0)
2642MeshPart13.Position = Vector3.new(14.957962, 1.14786196, 59.2372627)
2643MeshPart13.Rotation = Vector3.new(-180, -89.0500031, -180)
2644MeshPart13.Color = Color3.new(0.105882, 0.164706, 0.207843)
2645MeshPart13.Size = Vector3.new(0.225147113, 0.225146979, 1.30553198)
2646MeshPart13.Anchored = true
2647MeshPart13.BrickColor = BrickColor.new("Black")
2648MeshPart13.CanCollide = false
2649MeshPart13.Material = Enum.Material.Metal
2650MeshPart13.brickColor = BrickColor.new("Black")
2651MeshPart13.TextureID = "rbxassetid://1888432391"
2652UnionOperation14.Name = "Part"
2653UnionOperation14.Parent = Tool0
2654UnionOperation14.CFrame = CFrame.new(15.2212744, 1.48950696, 59.2497597, -0.999861181, 2.03726813e-10, 0.0165353585, 3.23052518e-09, 1.00000429, 5.76605999e-08, -0.016535392, 4.32664109e-08, -0.999863446)
2655UnionOperation14.Orientation = Vector3.new(0, 179.050003, 0)
2656UnionOperation14.Position = Vector3.new(15.2212744, 1.48950696, 59.2497597)
2657UnionOperation14.Rotation = Vector3.new(-180, 0.949999988, -180)
2658UnionOperation14.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
2659UnionOperation14.Size = Vector3.new(2.24977589, 0.370067656, 0.370067686)
2660UnionOperation14.Anchored = true
2661UnionOperation14.BrickColor = BrickColor.new("Really black")
2662UnionOperation14.CanCollide = false
2663UnionOperation14.Material = Enum.Material.SmoothPlastic
2664UnionOperation14.Reflectance = 0.34000000357628
2665UnionOperation14.brickColor = BrickColor.new("Really black")
2666MeshPart15.Name = "Part"
2667MeshPart15.Parent = Tool0
2668MeshPart15.CFrame = CFrame.new(15.2293081, 1.47220504, 59.2521515, -0.0165353138, 2.03726813e-10, -0.999861181, -5.76605999e-08, 1.00000429, 3.23052518e-09, 0.999863446, 4.32664109e-08, -0.0165353473)
2669MeshPart15.Orientation = Vector3.new(0, -90.9499969, 0)
2670MeshPart15.Position = Vector3.new(15.2293081, 1.47220504, 59.2521515)
2671MeshPart15.Rotation = Vector3.new(-180, -89.0500031, -180)
2672MeshPart15.Color = Color3.new(0.294118, 0.592157, 0.294118)
2673MeshPart15.Size = Vector3.new(0.456830859, 0.529308558, 2.27767897)
2674MeshPart15.Anchored = true
2675MeshPart15.BrickColor = BrickColor.new("Bright green")
2676MeshPart15.CanCollide = false
2677MeshPart15.Material = Enum.Material.Metal
2678MeshPart15.brickColor = BrickColor.new("Bright green")
2679MeshPart15.TextureID = "rbxassetid://1888432391"
2680IntValue16.Name = "Ammo"
2681IntValue16.Parent = Tool0
2682IntValue16.Value = 5
2683IntValue17.Name = "ClipSize"
2684IntValue17.Parent = Tool0
2685IntValue17.Value = 5
2686IntValue18.Name = "LethalGrenades"
2687IntValue18.Parent = Tool0
2688IntValue18.Value = 15
2689IntValue19.Name = "StoredAmmo"
2690IntValue19.Parent = Tool0
2691IntValue19.Value = 50
2692IntValue20.Name = "TacticalGrenades"
2693IntValue20.Parent = Tool0
2694IntValue20.Value = 15
2695Script21.Name = "[[README]]"
2696Script21.Parent = Tool0
2697table.insert(cors,sandbox(Script21,function()
2698--[[
2699
2700 VERSION: v0.0.4
2701
2702 ----------[ UPDATES ]----------------------------------------------------
2703
2704 Pre-Release: -Added a copyright
2705 -fixed the issue where you couldn't run when you selected the tool
2706 -Added an ADS key and allowed ADS to either be toggle or hold
2707 -Made the Ammo values external so they can be changed by outside scripts
2708
2709 v0.0.2: -Created new arms for the gun
2710 -Fixed an issue where the arms would glitch if PlayerAnimations was set to false and the gun was fired
2711 -Updated credit security
2712 -Put the Arm cframes in the SETTINGS
2713 -Made the stance changing animations slightly smoother
2714 -Added bullet drop
2715 -Fixed some bullet hit handling code
2716 -Made the torso being able to rotate while sitting down a setting
2717 -Added bullet settings
2718 -Added shockwave settings
2719 -Added an Explosive guntype
2720 -Added a version label in the Gui
2721
2722 v0.0.3: -Added an option to have player arms
2723 -Added grenades / throwables
2724 -Fixed the issue where if a player left a server without deselecting the gun, the bullet trails still remained
2725 -Added Gui Scopes
2726 -Fixed the issue where the guns would glitch if you switched weapons too fast
2727
2728 v0.0.4: -Updated the Gui
2729 -Added a "Table Of Contents" in the clientMain
2730 -Added PLUGINS
2731 -Added the Arm CFrame when Running in the SETTINGS
2732 -Added Mouse Sensitivity settings
2733 -Fixed an issue where a humanoid wouldn't be damaged by bullets if there was no space between a wall and the humanoid
2734 -Fixed the issue where you couldn't steady the scope if the steady key was different from the run key
2735 -Added an example flashlight and laser (You can delete them and the gun will still work fine)
2736 -Moved the movement animations into a separate module script for easier editing
2737 -Added a single bullet mag option. It allows people to make guns where the mag is the bullet itself (i.e. arrows)
2738 -Moved grenades into a seperate folder and made them server-side so they don't get deleted when you die or switch guns
2739 -Added an option for a second knife animation
2740 -Added a setting to change the throwing speed of the grenades
2741 -Added an auto-knife feature
2742 -Added a setting for whether the gun can ADS or not
2743 -Added a flashbang and a molotov to the grenade list
2744 -Fixed an issue where bullets could only penetrate 1 wall
2745 -Added gun sway for when you move the gun around
2746 -Made the camera type scriptable when the gun is selected
2747 -Moved the ignore model creating code into a seperate server script so the ReadMe can be deleted
2748 -Redesigned the animations so the transitions between idling, walking, and running are smooth instead of choppy like previously
2749 -Added a fire select option
2750 -Added an equip animation option
2751 -Added a crawling animation option
2752 -Fixed the issue where you could dive and jump at the same time
2753 -Moved the reload animation into the ANIMATIONS modulescript for easier editing
2754 -Added an option to enable reloading while running
2755 -Added an option to enable firing while running
2756 -Redesigned the recoil animation and based it more on battlefield
2757 -Edited the reload so if a bullet is already chambered and you reload the ammo will be the ClipSize + 1
2758 -Fixed the issue where the ammo would go to 0 if you stopped the reload
2759 -Fixed the issue where if you stopped the reload before you put in a new mag the gun would take another full clipsize from the storedammo
2760 -Fixed an issue where if the gun was removed without being deselected, the camera would break
2761 -Got rid of the gunName and gunDescription settings because they're unnecessary and annoying to change
2762 -Moved bullet impact object creation to server side
2763 -Added a bullet smoke impact setting
2764 -Added a blood particle setting that appears on a player when they're shot
2765 -Updated the scope
2766 -Added CanCollide, transparency, and custom ignore settings to the penetration settings
2767 -Moved trail creation to server side to prevent client lag
2768 -Fixed an issue where shooting a player's hat would do damage
2769
2770 -------------------------------------------------------------------------
2771
2772 Hello there!
2773
2774 Glad to know you're using my one and only Gun Kit!
2775
2776 Even though this kit has many features and is rather advanced, it's pretty easy to use
2777
2778 There are 4 things that this gun needs in order to function:
2779 One brick called "AimPart"
2780 At least one brick where the first 3 letters are "Mag"
2781 One brick called "Handle"
2782 One brick called "Main"
2783
2784 The AimPart is what the gun will use to aim down the sights. When you aim down your sights, this brick will be in the center
2785 of the player's head. It basically allows the gun to have any type of sight, which can be placed anywhere on the gun. As long as
2786 the AimPart is aligned with the sight, the gun will aim down the sights properly.
2787 (NOTE: Make sure the AimPart is behind the Sight and the FRONT of the AimPart is facing the Sight)
2788
2789 The Mag is what the gun will move around when you reload the gun. If the mag is made up of more than one brick, make sure the first
2790 3 leters of the bricks are also "Mag" so that the gun will move them around. If you set ReloadAnimation to false in the SETTINGS, you don't
2791 need any bricks called "Mag". But if ReloadAnimation is set to true, the gun needs at least one brick called "Mag" or it will break. It doesn't
2792 matter what comes after the "Mag", you can have a Mag brick called "Mag1" and another Mag brick called "MagA". As long as the first three letters are
2793 "Mag", then the gun will recognize it as a Mag
2794
2795 The Handle is obviously the most important part of the Gun. Without it, the tool itself wouldn't work. It's that simple
2796 (NOTE: If you want a sound to play when you fire, name it "FireSound" and place it in the Handle. If you want a sound to play when
2797 you reload, name it "ReloadSound" and place it in the Handle)
2798
2799 The Main is the brick where the bullets will originate from. It's also the brick where the flash effects are kept.
2800 (NOTE: If you want a muzzle flash effects, put them in the Main and call them "FlashFX". Also make sure they have an "Enabled"
2801 property so that the script can enable and disable them)
2802
2803 ----------[ INSTRUCTIONS ]-----------------------------------------------
2804
2805 HOW TO USE THIS KIT:
2806 1) If the gun already has a Handle, make sure it is facing forward. If the gun doesn't have a Handle, create one and place
2807 it wherever you like, and make sure it is facing forward
2808
2809 2) If the gun already has a brick called "AimPart", move it to where you would like, and make sure it is facing the sight.
2810 If the gun doesn't have a brick called "AimPart", create one and move it where you would like it to be, and make sure
2811 it is facing the sight
2812
2813 3) If the gun already has a brick called "Main", move it to the very front of the gun. If the gun doesn't have a brick
2814 called "Main", create one and move it to the very front of the gun
2815
2816 4) If ReloadAnimation is set to true in the SETTINGS, make sure the gun has at least one brick called "Mag". If
2817 ReloadAnimation is set to false, the gun doesn't need any bricks called "Mag".
2818
2819 5) Open the SETTINGS and edit them however you like
2820
2821 That's it! Only 5 steps! It's not that complicated, just follow the Directions and it should work fine. If you have any questions /
2822 comments / concerns, message me.
2823
2824 ______ ______ __ ______ _ ______
2825 / _/ _/ /_ __/_ _______/ /_ ____ / ____/_ _______(_)___ ____ / / /
2826 / // / / / / / / / ___/ __ \/ __ \/ /_ / / / / ___/ / __ \/ __ \ / // /
2827 / // / / / / /_/ / / / /_/ / /_/ / __/ / /_/ (__ ) / /_/ / / / / / // /
2828 / // / /_/ \__,_/_/ /_.___/\____/_/ \__,_/____/_/\____/_/ /_/ _/ // /
2829 /__/__/ /__/__/
2830
2831--]]
2832end))
2833Script22.Name = "serverMain"
2834Script22.Parent = Tool0
2835table.insert(cors,sandbox(Script22,function()
2836local Plyr = script:WaitForChild("Plyr")
2837
2838local Gun = script.Parent
2839local Handle = Gun:WaitForChild("Handle")
2840
2841local V3 = Vector3.new
2842local CF, CFANG = CFrame.new, CFrame.Angles
2843
2844local RAD = math.rad
2845
2846local numLerp = function(A, B, Alpha)
2847 return A + (B - A) * Alpha
2848end
2849
2850local inList = function(Element, List)
2851 for _, v in pairs(List) do
2852 if v == Element then
2853 return true
2854 end
2855 end
2856 return false
2857end
2858
2859----------------------------------------------------------------------
2860--------------------[ IGNORE MODEL HANDLING ]-------------------------
2861----------------------------------------------------------------------
2862
2863wait(math.random(0, 20) / 40) --This is to prevent more than one ignoreModel from being created
2864
2865if _G.ignoreCode then --If the ignoreCode already exists, then the script creates the ignoreModel
2866 --[[
2867 The purpose of this is so that every gun in a game that uses this gun kit will share one ignoreModel. That way,
2868 bullet trails, bullet holes, and other fake arms will be ignored by the gun which makes the bullets more likely to
2869 hit a character part
2870 --]]
2871 if (not game.Workspace:FindFirstChild("ignoreModel_".._G.ignoreCode)) then
2872 local ignoreModel = Instance.new("Model")
2873 ignoreModel.Name = "ignoreModel_".._G.ignoreCode
2874 ignoreModel.Parent = game.Workspace
2875
2876 local grenadeFolder = Instance.new("Model")
2877 grenadeFolder.Name = "grenadeFolder"
2878 grenadeFolder.Parent = ignoreModel
2879
2880 spawn(function()
2881 while true do
2882 ignoreModel.Parent = game.Workspace
2883 grenadeFolder.Parent = ignoreModel
2884 wait(1 / 20)
2885 end
2886 end)
2887 end
2888
2889 script.Parent:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value = _G.ignoreCode
2890else
2891 --[[
2892 If there isn't already an ignoreCode, then this creates one. The purpose of it being random is so that if there is
2893 an ignoreModel for something else in the game, the script won't end up placing the ignored objects in that ignoreModel
2894 --]]
2895 _G.ignoreCode = math.random(1, 1e4)
2896
2897 if (not game.Workspace:FindFirstChild("ignoreModel_".._G.ignoreCode)) then
2898 local ignoreModel = Instance.new("Model")
2899 ignoreModel.Name = "ignoreModel_".._G.ignoreCode
2900 ignoreModel.Parent = game.Workspace
2901
2902 local grenadeFolder = Instance.new("Model")
2903 grenadeFolder.Name = "grenadeFolder"
2904 grenadeFolder.Parent = ignoreModel
2905
2906 spawn(function()
2907 while true do
2908 ignoreModel.Parent = game.Workspace
2909 grenadeFolder.Parent = ignoreModel
2910 wait(1 / 20)
2911 end
2912 end)
2913 end
2914
2915 script.Parent:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value = _G.ignoreCode
2916end
2917
2918spawn(function()
2919 --[[
2920 This function deletes any Player Folders that were left in the ignoreModel because the player left the game without
2921 deselecting the Gun first
2922 --]]
2923 repeat wait() until _G.ignoreCode
2924 local ignoreModel = game.Workspace:WaitForChild("ignoreModel_".._G.ignoreCode)
2925 while true do
2926 for _, gunIgnore in pairs(ignoreModel:GetChildren()) do
2927 if gunIgnore.Name ~= "grenadeFolder" then
2928 if (not game.Players:FindFirstChild(gunIgnore.Name:sub(11))) then
2929 gunIgnore:Destroy()
2930 end
2931 end
2932 end
2933 wait(1 / 20)
2934 end
2935end)
2936
2937----------------------------------------------------------------------
2938--------------------[ RESET CAMERA ]----------------------------------
2939----------------------------------------------------------------------
2940
2941Gun.ChildRemoved:connect(function(Child)
2942 if Child == Handle and Plyr.Value then
2943 local ignoreCode = Gun:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value
2944 local resetCam = script:WaitForChild("resetCam")
2945 resetCam:WaitForChild("ignoreCode").Value = ignoreCode
2946 resetCam.Parent = Plyr.Value.PlayerGui
2947 end
2948end)
2949
2950----------------------------------------------------------------------
2951--------------------[ GET WELD CFRAMES ]------------------------------
2952----------------------------------------------------------------------
2953
2954for _, v in pairs(Gun:GetChildren()) do
2955 if v:IsA("BasePart") and v ~= Handle then
2956 if v:FindFirstChild("mainWeld") then v.mainWeld:Destroy() end
2957 if (not v:FindFirstChild("weldCF")) then
2958 local weldCF = Instance.new("CFrameValue")
2959 weldCF.Name = "weldCF"
2960 weldCF.Value = Handle.CFrame:toObjectSpace(v.CFrame)
2961 weldCF.Parent = v
2962 end
2963 if string.sub(v.Name, 1, 3) == "Mag" then
2964 if (not v:FindFirstChild("magTrans")) then
2965 local magTrans = Instance.new("NumberValue")
2966 magTrans.Name = "magTrans"
2967 magTrans.Value = v.Transparency
2968 magTrans.Parent = v
2969 end
2970 end
2971 v.Anchored = true
2972 v.CanCollide = false
2973 end
2974end
2975Handle.Anchored = false
2976Handle.CanCollide = true
2977
2978----------------------------------------------------------------------
2979--------------------[ GUNSETUP HANDLING ]-----------------------------
2980----------------------------------------------------------------------
2981
2982local gunSetup = script:WaitForChild("gunSetup")
2983function gunSetup.OnServerInvoke(Player, Vars)
2984
2985 --------------------[ CREATING IGNORE MODELS ]--------------------------------
2986
2987 local gunIgnore = Instance.new("Model")
2988 gunIgnore.Name = "gunIgnore_"..Player.Name
2989 gunIgnore.Parent = Vars.ignoreModel
2990
2991 --------------------[ MODIFYING THE PLAYER ]----------------------------------
2992
2993 Vars.Humanoid.AutoRotate = false
2994
2995 Vars.Shoulders.Right.Part1 = nil
2996 Vars.Shoulders.Left.Part1 = nil
2997
2998 local playerFolder = Instance.new("Model")
2999 playerFolder.Name = "playerFolder"
3000 playerFolder.Parent = gunIgnore
3001
3002 local headBase = Instance.new("Part")
3003 headBase.Transparency = 1
3004 headBase.Name = "headBase"
3005 headBase.CanCollide = false
3006 headBase.FormFactor = Enum.FormFactor.Custom
3007 headBase.Size = V3(0.2, 0.2, 0.2)
3008 headBase.BottomSurface = Enum.SurfaceType.Smooth
3009 headBase.TopSurface = Enum.SurfaceType.Smooth
3010 headBase.Parent = playerFolder
3011
3012 local headWeld = Instance.new("Weld")
3013 headWeld.Part0 = Vars.Torso
3014 headWeld.Part1 = headBase
3015 headWeld.C0 = CF(0, 1.5, 0)
3016 headWeld.Parent = Vars.Torso
3017
3018 local headWeld2 = Instance.new("Weld")
3019 headWeld2.Part0 = headBase
3020 headWeld2.Part1 = Vars.Head
3021 headWeld2.Parent = headBase
3022
3023 local animBase = Instance.new("Part")
3024 animBase.Transparency = 1
3025 animBase.Name = "animBase"
3026 animBase.CanCollide = false
3027 animBase.FormFactor = Enum.FormFactor.Custom
3028 animBase.Size = V3(0.2, 0.2, 0.2)
3029 animBase.BottomSurface = Enum.SurfaceType.Smooth
3030 animBase.TopSurface = Enum.SurfaceType.Smooth
3031 animBase.Parent = playerFolder
3032
3033 local animWeld = Instance.new("Weld")
3034 animWeld.Part0 = animBase
3035 animWeld.Part1 = headBase
3036 animWeld.Parent = animBase
3037
3038 local armBase = Instance.new("Part")
3039 armBase.Transparency = 1
3040 armBase.Name = "ArmBase"
3041 armBase.CanCollide = false
3042 armBase.FormFactor = Enum.FormFactor.Custom
3043 armBase.Size = V3(0.2, 0.2, 0.2)
3044 armBase.BottomSurface = Enum.SurfaceType.Smooth
3045 armBase.TopSurface = Enum.SurfaceType.Smooth
3046 armBase.Parent = playerFolder
3047
3048 local ABWeld = Instance.new("Weld")
3049 ABWeld.Part0 = armBase
3050 ABWeld.Part1 = animBase
3051 ABWeld.Parent = armBase
3052
3053 local LArmBase = Instance.new("Part")
3054 LArmBase.Transparency = 1
3055 LArmBase.Name = "LArmBase"
3056 LArmBase.CanCollide = false
3057 LArmBase.FormFactor = Enum.FormFactor.Custom
3058 LArmBase.Size = V3(0.2, 0.2, 0.2)
3059 LArmBase.BottomSurface = Enum.SurfaceType.Smooth
3060 LArmBase.TopSurface = Enum.SurfaceType.Smooth
3061 LArmBase.Parent = playerFolder
3062
3063 local RArmBase = Instance.new("Part")
3064 RArmBase.Transparency = 1
3065 RArmBase.Name = "RArmBase"
3066 RArmBase.CanCollide = false
3067 RArmBase.FormFactor = Enum.FormFactor.Custom
3068 RArmBase.Size = V3(0.2, 0.2, 0.2)
3069 RArmBase.BottomSurface = Enum.SurfaceType.Smooth
3070 RArmBase.TopSurface = Enum.SurfaceType.Smooth
3071 RArmBase.Parent = playerFolder
3072
3073 local LWeld = Instance.new("Weld")
3074 LWeld.Name = "LWeld"
3075 LWeld.Part0 = armBase
3076 LWeld.Part1 = LArmBase
3077 LWeld.C0 = Vars.armC0[1]
3078 LWeld.C1 = Vars.leftArmC1
3079 LWeld.Parent = armBase
3080
3081 local RWeld = Instance.new("Weld")
3082 RWeld.Name = "RWeld"
3083 RWeld.Part0 = armBase
3084 RWeld.Part1 = RArmBase
3085 RWeld.C0 = Vars.armC0[2]
3086 RWeld.C1 = Vars.rightArmC1
3087 RWeld.Parent = armBase
3088
3089 local LWeld2 = Instance.new("Weld")
3090 LWeld2.Name = "LWeld"
3091 LWeld2.Part0 = LArmBase
3092 LWeld2.Part1 = Vars.LArm
3093 LWeld2.Parent = LArmBase
3094
3095 local RWeld2 = Instance.new("Weld")
3096 RWeld2.Name = "RWeld"
3097 RWeld2.Part0 = RArmBase
3098 RWeld2.Part1 = Vars.RArm
3099 RWeld2.Parent = RArmBase
3100
3101 local LLegWeld = Instance.new("Weld")
3102 LLegWeld.Name = "LLegWeld"
3103 LLegWeld.Part0 = Vars.Torso
3104 LLegWeld.Part1 = nil
3105 LLegWeld.C0 = CF(-0.5, -2, 0)
3106 LLegWeld.Parent = Vars.Torso
3107
3108 local RLegWeld = Instance.new("Weld")
3109 RLegWeld.Name = "RLegWeld"
3110 RLegWeld.Part0 = Vars.Torso
3111 RLegWeld.Part1 = nil
3112 RLegWeld.C0 = CF(0.5, -2, 0)
3113 RLegWeld.Parent = Vars.Torso
3114
3115 for _, Tab in pairs(Vars.gunParts) do
3116 Tab.Obj.Anchored = false
3117 local Weld = Instance.new("Weld")
3118 Weld.Name = "mainWeld"
3119 Weld.Part0 = Vars.Handle
3120 Weld.Part1 = Tab.Obj
3121 Weld.C0 = Tab.Obj.weldCF.Value
3122 Weld.Parent = Vars.Handle
3123 Tab.Weld = Weld
3124 end
3125
3126 return gunIgnore, playerFolder, headWeld, headWeld2, animWeld, ABWeld, LWeld, RWeld, LWeld2, RWeld2, LLegWeld, RLegWeld, Vars.gunParts
3127end
3128
3129----------------------------------------------------------------------
3130--------------------[ TWEENJOINT HANDLING ]---------------------------
3131----------------------------------------------------------------------
3132
3133local createTweenIndicator = script:WaitForChild("createTweenIndicator")
3134function createTweenIndicator.OnServerInvoke(_, Joint, newCode)
3135 local tweenIndicator = nil
3136 if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
3137 tweenIndicator = Instance.new("IntValue")
3138 tweenIndicator.Name = "tweenCode"
3139 tweenIndicator.Value = newCode
3140 tweenIndicator.Parent = Joint
3141 else
3142 tweenIndicator = Joint.tweenCode
3143 tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
3144 end
3145 return tweenIndicator
3146end
3147
3148local lerpCF = script:WaitForChild("lerpCF")
3149function lerpCF.OnServerInvoke(_, Joint, Prop, startCF, endCF, Alpha)
3150 spawn(function()
3151 Joint[Prop] = startCF:lerp(endCF, Alpha)
3152 end)
3153end
3154
3155local deleteTweenIndicator = script:WaitForChild("deleteTweenIndicator")
3156function deleteTweenIndicator.OnServerInvoke(_, tweenIndicator, newCode)
3157 if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
3158 tweenIndicator:Destroy()
3159 end
3160end
3161
3162----------------------------------------------------------------------
3163--------------------[ BULLET IMPACT HANDLING ]------------------------
3164----------------------------------------------------------------------
3165
3166local createBulletImpact = script:WaitForChild("createBulletImpact")
3167createBulletImpact.OnServerEvent:connect(function(_, H, P, N, D, humanoidFound, gunIgnore, S)
3168 local surfaceCF = CF(P, P + N)
3169 ----------------------------------------------------------------------------------
3170 --Creating the bullet hole--------------------------------------------------------
3171 ----------------------------------------------------------------------------------
3172 if S.bulletHoles and (not humanoidFound) then
3173 local Hole = Instance.new("Part")
3174 Hole.Transparency = 1
3175 Hole.Anchored = true
3176 Hole.CanCollide = false
3177 Hole.FormFactor = "Custom"
3178 Hole.Size = V3(1, 1, 0.2)
3179 Hole.TopSurface = 0
3180 Hole.BottomSurface = 0
3181 local Mesh = Instance.new("BlockMesh")
3182 Mesh.Offset = V3(0, 0, -0.05)
3183 Mesh.Scale = V3(S.holeSettings.Size, S.holeSettings.Size, 0)
3184 Mesh.Parent = Hole
3185 local Decal = Instance.new("Decal")
3186 Decal.Face = Enum.NormalId.Front
3187 Decal.Texture = S.holeSettings.Texture
3188 Decal.Parent = Hole
3189 Hole.Parent = gunIgnore
3190 Hole.CFrame = surfaceCF
3191 if (not H.Anchored) then
3192 local Weld = Instance.new("Weld", Hole)
3193 Weld.Part0 = H
3194 Weld.Part1 = Hole
3195 Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
3196 Hole.Anchored = false
3197 end
3198 delay(S.holeSettings.visibleTime, function()
3199 if S.holeSettings.disappearTime > 0 then
3200 local t0 = tick()
3201 while true do
3202 local Alpha = math.min((tick() - t0) / S.holeSettings.disappearTime, 1)
3203 Decal.Transparency = numLerp(0, 1, Alpha)
3204 if Alpha == 1 then break end
3205 wait()
3206 end
3207 Hole:Destroy()
3208 else
3209 Hole:Destroy()
3210 end
3211 end)
3212 end
3213 ----------------------------------------------------------------------------------
3214 --Creating the spark effect-------------------------------------------------------
3215 ----------------------------------------------------------------------------------
3216 if S.bulletSparks and (not humanoidFound) and inList(H.Material, S.sparkSettings.Materials) then
3217 local Sparks = Instance.new("Part")
3218 Sparks.Transparency = 1
3219 Sparks.Anchored = true
3220 Sparks.CanCollide = false
3221 Sparks.FormFactor = "Custom"
3222 Sparks.Size = V3(1, 1, 1)
3223 Sparks.TopSurface = 0
3224 Sparks.BottomSurface = 0
3225
3226 local Particles = Instance.new("ParticleEmitter")
3227 Particles.Color = ColorSequence.new(S.sparkSettings.Color)
3228 Particles.LightEmission = 1
3229 Particles.Size = NumberSequence.new(S.sparkSettings.Size)
3230 Particles.Texture = S.sparkSettings.Texture
3231 Particles.Transparency = NumberSequence.new(
3232 {
3233 NumberSequenceKeypoint.new(0, 0.25, 0.25);
3234 NumberSequenceKeypoint.new(1, 1);
3235 }
3236 )
3237 Particles.Acceleration = V3(0, -196.2, 0)
3238 Particles.EmissionDirection = Enum.NormalId.Front
3239 Particles.Lifetime = NumberRange.new(S.sparkSettings.Lifetime - 0.05, S.sparkSettings.Lifetime + 0.05)
3240 Particles.Rate = S.sparkSettings.Rate
3241 Particles.RotSpeed = NumberRange.new(360)
3242 Particles.Speed = NumberRange.new(S.sparkSettings.Speed - 5, S.sparkSettings.Speed + 5)
3243 Particles.VelocitySpread = S.sparkSettings.Spread
3244 Particles.Parent = Sparks
3245
3246 Sparks.Parent = gunIgnore
3247 Sparks.CFrame = surfaceCF
3248 if (not H.Anchored) then
3249 local Weld = Instance.new("Weld", Sparks)
3250 Weld.Part0 = H
3251 Weld.Part1 = Sparks
3252 Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
3253 Sparks.Anchored = false
3254 end
3255 delay(0.1, function()
3256 Particles.Enabled = false
3257 wait(S.sparkSettings.Lifetime + 0.05)
3258 Sparks:Destroy()
3259 end)
3260 end
3261 ----------------------------------------------------------------------------------
3262 --Creating the smoke effect-------------------------------------------------------
3263 ----------------------------------------------------------------------------------
3264 if S.bulletSmoke and (not humanoidFound) then
3265 local Smoke = Instance.new("Part")
3266 Smoke.Transparency = 1
3267 Smoke.Anchored = true
3268 Smoke.CanCollide = false
3269 Smoke.FormFactor = "Custom"
3270 Smoke.Size = V3(1, 1, 1)
3271 Smoke.TopSurface = 0
3272 Smoke.BottomSurface = 0
3273
3274 local Particles = Instance.new("ParticleEmitter")
3275 Particles.Color = ColorSequence.new(S.smokeSettings.objColor and H.Color or S.smokeSettings.Color)
3276 Particles.LightEmission = 0
3277 Particles.Size = NumberSequence.new(
3278 {
3279 NumberSequenceKeypoint.new(0, S.smokeSettings.Size.Start);
3280 NumberSequenceKeypoint.new(1, S.smokeSettings.Size.End);
3281 }
3282 )
3283 Particles.Texture = S.smokeSettings.Texture
3284 Particles.Transparency = NumberSequence.new(
3285 {
3286 NumberSequenceKeypoint.new(0, S.smokeSettings.startTransparency);
3287 NumberSequenceKeypoint.new(0.5, 0.75 * S.smokeSettings.startTransparency + 0.25);
3288 NumberSequenceKeypoint.new(1, 1);
3289 }
3290 )
3291 Particles.Acceleration = V3(0, -196.2, 0)
3292 Particles.EmissionDirection = Enum.NormalId.Front
3293 Particles.Lifetime = NumberRange.new(S.smokeSettings.Lifetime - 0.05, S.smokeSettings.Lifetime + 0.05)
3294 Particles.Rate = S.smokeSettings.Rate
3295 Particles.Rotation = NumberRange.new(0, 360)
3296 Particles.RotSpeed = NumberRange.new(10)
3297 Particles.Speed = NumberRange.new(S.smokeSettings.Speed - 5, S.smokeSettings.Speed + 5)
3298 Particles.VelocitySpread = S.smokeSettings.Spread
3299 Particles.Parent = Smoke
3300
3301 Smoke.Parent = gunIgnore
3302 Smoke.CFrame = surfaceCF
3303 if (not H.Anchored) then
3304 local Weld = Instance.new("Weld", Smoke)
3305 Weld.Part0 = H
3306 Weld.Part1 = Smoke
3307 Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
3308 Smoke.Anchored = false
3309 end
3310 delay(0.1, function()
3311 Particles.Enabled = false
3312 wait(S.smokeSettings.Lifetime + 0.05)
3313 Smoke:Destroy()
3314 end)
3315 end
3316end)
3317
3318----------------------------------------------------------------------
3319--------------------[ SHOCKWAVE HANDLING ]----------------------------
3320----------------------------------------------------------------------
3321
3322local createShockwave = script:WaitForChild("createShockwave")
3323createShockwave.OnServerEvent:connect(function(_, Center, Radius, gunIgnore, S)
3324 local Shockwave = Instance.new("Part")
3325 Shockwave.BrickColor = S.shockwaveSettings.Color
3326 Shockwave.Material = Enum.Material.SmoothPlastic
3327 Shockwave.Name = "Shockwave"
3328 Shockwave.Anchored = true
3329 Shockwave.CanCollide = false
3330 Shockwave.FormFactor = Enum.FormFactor.Symmetric
3331 Shockwave.Size = V3(1, 1, 1)
3332 Shockwave.BottomSurface = Enum.SurfaceType.Smooth
3333 Shockwave.TopSurface = Enum.SurfaceType.Smooth
3334 local Mesh = Instance.new("SpecialMesh")
3335 Mesh.MeshType = Enum.MeshType.Sphere
3336 Mesh.Scale = V3()
3337 Mesh.Parent = Shockwave
3338 Shockwave.Parent = gunIgnore
3339 Shockwave.CFrame = CF(Center)
3340 spawn(function()
3341 local t0 = tick()
3342 while true do
3343 local Alpha = math.min((tick() - t0) / S.shockwaveSettings.Duration, 1)
3344 local Scale = 2 * Radius * Alpha
3345 Mesh.Scale = V3(Scale, Scale, Scale)
3346 Shockwave.Transparency = Alpha
3347 if Alpha == 1 then break end
3348 wait()
3349 end
3350 Shockwave:Destroy()
3351 end)
3352end)
3353
3354----------------------------------------------------------------------
3355--------------------[ BLOOD HANDLING ]--------------------------------
3356----------------------------------------------------------------------
3357
3358local createBlood = script:WaitForChild("createBlood")
3359createBlood.OnServerEvent:connect(function(_, H, P, D, gunIgnore, S)
3360 local bloodCF = CF(P, P + D) * CFANG(RAD(-90), 0, 0)
3361 local Blood = Instance.new("Part")
3362 Blood.Transparency = 1
3363 Blood.Anchored = true
3364 Blood.CanCollide = false
3365 Blood.FormFactor = "Custom"
3366 Blood.Size = V3(0.2, 1, 0.2)
3367 Blood.TopSurface = 0
3368 Blood.BottomSurface = 0
3369
3370 local Particles = Instance.new("ParticleEmitter")
3371 Particles.Color = ColorSequence.new(S.bloodSettings.Color)
3372 Particles.LightEmission = 0
3373 Particles.Size = NumberSequence.new(S.bloodSettings.Size)
3374 Particles.Texture = S.bloodSettings.Texture
3375 Particles.Transparency = NumberSequence.new(
3376 {
3377 NumberSequenceKeypoint.new(0, S.bloodSettings.startTransparency);
3378 NumberSequenceKeypoint.new(1, 1);
3379 }
3380 )
3381 Particles.EmissionDirection = Enum.NormalId.Top
3382 Particles.Lifetime = NumberRange.new(S.bloodSettings.Lifetime - 0.05, S.bloodSettings.Lifetime + 0.05)
3383 Particles.Rate = S.bloodSettings.Rate
3384 Particles.Rotation = NumberRange.new(0, 90)
3385 Particles.Speed = NumberRange.new(S.bloodSettings.Speed)
3386 Particles.VelocitySpread = S.bloodSettings.Spread
3387 Particles.Parent = Blood
3388
3389 Blood.Parent = gunIgnore
3390 Blood.CFrame = bloodCF
3391 if (not H.Anchored) then
3392 local Weld = Instance.new("Weld", Blood)
3393 Weld.Part0 = H
3394 Weld.Part1 = Blood
3395 Weld.C0 = H.CFrame:toObjectSpace(bloodCF)
3396 Blood.Anchored = false
3397 end
3398 delay(0.15, function()
3399 Particles.Enabled = false
3400 wait(S.bloodSettings.Lifetime + 0.05)
3401 Blood:Destroy()
3402 end)
3403end)
3404
3405----------------------------------------------------------------------
3406--------------------[ TRAIL HANDLING ]--------------------------------
3407----------------------------------------------------------------------
3408
3409local createTrail = script:WaitForChild("createTrail")
3410createTrail.OnServerEvent:connect(function(_, Origin, P, gunIgnore, S)
3411 local Trail = Instance.new("Part")
3412 Trail.BrickColor = S.trailSettings.Color
3413 Trail.Transparency = S.trailSettings.Transparency
3414 Trail.Anchored = true
3415 Trail.CanCollide = false
3416 Trail.Size = V3(1, 1, 1)
3417 local Mesh = Instance.new("CylinderMesh")
3418 Mesh.Offset = V3(0, -(P - Origin).magnitude / 2, 0)
3419 Mesh.Scale = V3(S.trailSettings.Thickness, (P - Origin).magnitude, S.trailSettings.Thickness)
3420 Mesh.Parent = Trail
3421 Trail.Parent = gunIgnore
3422 Trail.CFrame = CF(Origin, P) * CFANG(RAD(90), 0, 0)
3423 delay(S.trailSettings.visibleTime, function()
3424 if S.trailSettings.disappearTime > 0 then
3425 local t0 = tick()
3426 while true do
3427 local Alpha = math.min((tick() - t0) / S.trailSettings.disappearTime, 1)
3428 Trail.Transparency = numLerp(S.trailSettings.Transparency, 1, Alpha)
3429 if Alpha == 1 then break end
3430 wait()
3431 end
3432 Trail:Destroy()
3433 else
3434 Trail:Destroy()
3435 end
3436 end)
3437end)
3438end))
3439ObjectValue23.Name = "Plyr"
3440ObjectValue23.Parent = Script22
3441RemoteFunction24.Name = "getWeldCF"
3442RemoteFunction24.Parent = Script22
3443RemoteFunction25.Name = "gunSetup"
3444RemoteFunction25.Parent = Script22
3445RemoteFunction26.Name = "tweenJoint"
3446RemoteFunction26.Parent = Script22
3447RemoteEvent27.Name = "onRenderStep"
3448RemoteEvent27.Parent = Script22
3449RemoteFunction28.Name = "createTweenIndicator"
3450RemoteFunction28.Parent = Script22
3451RemoteFunction29.Name = "deleteTweenIndicator"
3452RemoteFunction29.Parent = Script22
3453RemoteFunction30.Name = "lerpCF"
3454RemoteFunction30.Parent = Script22
3455LocalScript31.Name = "resetCam"
3456LocalScript31.Parent = Script22
3457table.insert(cors,sandbox(LocalScript31,function()
3458repeat wait() until game.Players.LocalPlayer.Character
3459
3460local Player = game.Players.LocalPlayer
3461local Char = Player.Character
3462local Humanoid = Char:WaitForChild("Humanoid")
3463
3464local Cam = game.Workspace.CurrentCamera
3465local UIS = game:GetService("UserInputService")
3466
3467local ignoreCode = script:WaitForChild("ignoreCode")
3468repeat wait() until ignoreCode.Value ~= 0
3469local ignoreModel = game.Workspace:WaitForChild("ignoreModel_"..ignoreCode.Value)
3470local gunIgnore = ignoreModel:FindFirstChild("gunIgnore_"..Player.Name)
3471
3472Cam.FieldOfView = 70
3473Cam.CameraType = Enum.CameraType.Custom
3474Cam:ClearAllChildren()
3475
3476UIS.MouseBehavior = Enum.MouseBehavior.Default
3477UIS.MouseIconEnabled = true
3478
3479Player.CameraMode = Enum.CameraMode.Classic
3480
3481Humanoid.WalkSpeed = 16
3482Humanoid.AutoRotate = true
3483
3484if gunIgnore then gunIgnore:Destroy() end
3485end))
3486IntValue32.Name = "ignoreCode"
3487IntValue32.Parent = LocalScript31
3488RemoteEvent33.Name = "createBulletImpact"
3489RemoteEvent33.Parent = Script22
3490RemoteEvent34.Name = "createShockwave"
3491RemoteEvent34.Parent = Script22
3492RemoteEvent35.Name = "createBlood"
3493RemoteEvent35.Parent = Script22
3494RemoteEvent36.Name = "createTrail"
3495RemoteEvent36.Parent = Script22
3496LocalScript37.Name = "clientMain"
3497LocalScript37.Parent = Tool0
3498table.insert(cors,sandbox(LocalScript37,function()
3499--[[
3500Kit By TurboFusion
3501Remake By MuYhEt & Xander521
3502--]]
3503--------------------------------------------------------------------------------------
3504--------------------[ CHARACTER LOADING ]---------------------------------------------
3505--------------------------------------------------------------------------------------
3506
3507repeat wait() until game.Players.LocalPlayer.Character
3508repeat wait() until game.Players.LocalPlayer.Character:IsDescendantOf(game.Workspace)
3509wait(1 / 20)
3510
3511--------------------------------------------------------------------------------------
3512--------------------[ IGNORE MODEL ]--------------------------------------------------
3513--------------------------------------------------------------------------------------
3514
3515local ignoreCode = script:WaitForChild("ignoreCode")
3516
3517repeat wait() until ignoreCode.Value ~= 0
3518
3519local ignoreModel = game.Workspace:WaitForChild("ignoreModel_"..ignoreCode.Value)
3520
3521local grenadeFolder = ignoreModel:WaitForChild("grenadeFolder")
3522
3523--------------------------------------------------------------------------------------
3524--------------------[ CONSTANTS ]-----------------------------------------------------
3525--------------------------------------------------------------------------------------
3526
3527local Gun = script.Parent
3528local serverMain = Gun:WaitForChild("serverMain")
3529local Handle = Gun:WaitForChild("Handle")
3530local AimPart = Gun:WaitForChild("AimPart")
3531local Main = Gun:WaitForChild("Main")
3532
3533local Ammo = Gun:WaitForChild("Ammo")
3534local ClipSize = Gun:WaitForChild("ClipSize")
3535local StoredAmmo = Gun:WaitForChild("StoredAmmo")
3536
3537local createTweenIndicator = serverMain:WaitForChild("createTweenIndicator")
3538local deleteTweenIndicator = serverMain:WaitForChild("deleteTweenIndicator")
3539local getWeldCF = serverMain:WaitForChild("getWeldCF")
3540local gunSetup = serverMain:WaitForChild("gunSetup")
3541local lerpCF = serverMain:WaitForChild("lerpCF")
3542local createBlood = serverMain:WaitForChild("createBlood")
3543local createBulletImpact = serverMain:WaitForChild("createBulletImpact")
3544local createShockwave = serverMain:WaitForChild("createShockwave")
3545local createTrail = serverMain:WaitForChild("createTrail")
3546
3547local Particle = require(script:WaitForChild("Particle"))
3548local Spring = require(script:WaitForChild("Spring"))
3549local Anims = require(Gun:WaitForChild("ANIMATIONS"))
3550local Plugins = require(Gun:WaitForChild("PLUGINS"))
3551local S = require(Gun:WaitForChild("SETTINGS"))
3552
3553local Player = game.Players.LocalPlayer
3554local Char = Player.Character
3555local Humanoid = Char:WaitForChild("Humanoid")
3556local Torso = Char:WaitForChild("Torso")
3557local Head = Char:WaitForChild("Head")
3558local HRP = Char:WaitForChild("HumanoidRootPart")
3559local Root = HRP:WaitForChild("RootJoint")
3560
3561local Neck = Torso:WaitForChild("Neck")
3562
3563local LArm = Char:WaitForChild("Left Arm")
3564local RArm = Char:WaitForChild("Right Arm")
3565local LLeg = Char:WaitForChild("Left Leg")
3566local RLeg = Char:WaitForChild("Right Leg")
3567
3568local M2 = Player:GetMouse()
3569
3570local mainGUI = script:WaitForChild("mainGUI")
3571
3572local crossHair = mainGUI:WaitForChild("crossHair")
3573local HUD = mainGUI:WaitForChild("HUD")
3574local Scope = mainGUI:WaitForChild("Scope")
3575local fireSelect = mainGUI:WaitForChild("fireSelect")
3576local hitMarker = mainGUI:WaitForChild("hitMarker")
3577local Sens = mainGUI:WaitForChild("Sens")
3578
3579local crossA = crossHair:WaitForChild("A"):WaitForChild("Line")
3580local crossB = crossHair:WaitForChild("B"):WaitForChild("Line")
3581local crossC = crossHair:WaitForChild("C"):WaitForChild("Line")
3582local crossD = crossHair:WaitForChild("D"):WaitForChild("Line")
3583
3584local Controls = HUD:WaitForChild("Controls")
3585
3586local gunNameTitle = HUD:WaitForChild("gunName"):WaitForChild("Title")
3587
3588local scopeMain = Scope:WaitForChild("Main")
3589local scopeSteady = Scope:WaitForChild("Steady")
3590
3591local fireModes = fireSelect:WaitForChild("Modes")
3592
3593local modeGUI = HUD:WaitForChild("Mode"):WaitForChild("Main")
3594local clipAmmoGUI = HUD:WaitForChild("Ammo"):WaitForChild("Clip")
3595local storedAmmoGUI = HUD:WaitForChild("Ammo"):WaitForChild("Stored")
3596
3597local DS = game:GetService("Debris")
3598local CP = game:GetService("ContentProvider")
3599local RS = game:GetService("RunService")
3600local UIS = game:GetService("UserInputService")
3601
3602local Cam = game.Workspace.CurrentCamera
3603
3604local ABS, HUGE, FLOOR, CEIL = math.abs, math.huge, math.floor, math.ceil
3605local RAD, SIN, COS, TAN = math.rad, math.sin, math.cos, math.tan
3606local VEC2, V3 = Vector2.new, Vector3.new
3607local CF, CFANG = CFrame.new, CFrame.Angles
3608local INSERT = table.insert
3609
3610local maxStamina = S.sprintTime * 60
3611local maxSteadyTime = S.scopeSettings.steadyTime * 60
3612
3613local LethalIcons = {
3614 "http://www.roblox.com/asset/?id=194849880";
3615 "http://www.roblox.com/asset/?id=195727791";
3616 "http://www.roblox.com/asset/?id=195728137";
3617 "http://www.roblox.com/asset/?id=218151830";
3618}
3619
3620local TacticalIcons = {
3621 "http://www.roblox.com/asset/?id=195728473";
3622 "http://www.roblox.com/asset/?id=195728693";
3623}
3624
3625local ASCII = {
3626 071; 117; 110; 032;
3627 075; 105; 116; 032;
3628 115; 099; 114; 105;
3629 112; 116; 101; 100;
3630 032; 098; 121; 032;
3631 084; 117; 114; 098;
3632 111; 070; 117; 115;
3633 105; 111; 110; 000;
3634}
3635
3636local Ignore = {
3637 Char;
3638 ignoreModel;
3639}
3640
3641local Shoulders = {
3642 Right = Torso:WaitForChild("Right Shoulder");
3643 Left = Torso:WaitForChild("Left Shoulder")
3644}
3645
3646local armC0 = {
3647 CF(-1.5, 0, 0) * CFANG(RAD(90), 0, 0);
3648 CF(1.5, 0, 0) * CFANG(RAD(90), 0, 0);
3649}
3650
3651local legC0 = {
3652 Stand = {
3653 CF(-0.5, -2, 0);
3654 CF(0.5, -2, 0);
3655 };
3656 Crouch = {
3657 CF(-0.5, -1.5, 0.5) * CFANG(-RAD(90), 0, 0);
3658 CF(0.5, -1, -0.75);
3659 };
3660 Prone = {
3661 CF(-0.5, -2, 0);
3662 CF(0.5, -2, 0);
3663 };
3664}
3665
3666local Sine = function(X)
3667 return SIN(RAD(X))
3668end
3669
3670local Linear = function(X)
3671 return (X / 90)
3672end
3673
3674--------------------------------------------------------------------------------------
3675--------------------[ VARIABLES ]-----------------------------------------------------
3676--------------------------------------------------------------------------------------
3677
3678local Selected = false
3679
3680local playerMass = 0
3681
3682local Forward = false
3683local Backward = false
3684
3685local Idling = false
3686local Walking = false
3687local Running = false
3688
3689local crawlCamRot = 0
3690local crawlAlpha = 0
3691local idleAlpha = 1
3692local walkAlpha = 0
3693local isCrawling = false
3694local isIdling = false
3695local isWalking = false
3696local isRunning = false
3697
3698local Aimed = false
3699local Aiming = false
3700local aimAlpha = 0
3701local headOffset = VEC2(COS(RAD(90) - S.aimSettings.headTilt) * 0.5, 1 + SIN(RAD(90) - S.aimSettings.headTilt) * 0.5)
3702
3703local Reloading = false
3704local breakReload = false
3705local magVisible = true
3706local newMag = false
3707
3708local Knifing = false
3709
3710local MB1Down = false
3711local Firing = false
3712local canFire = true
3713local fireFunction = nil
3714local firstShot = false
3715local shotCount = 0
3716local lastSideRecoil = {0, 0}
3717local recoilAnim = {
3718 Pos = V3();
3719 Rot = V3();
3720 Code = nil;
3721}
3722
3723local numModes = 0
3724local rawFireMode = 1
3725local canSelectFire = true
3726local guiAngOffset = 0
3727local Modes = {}
3728
3729local onGround = true
3730local startFallHeight = 0
3731local jumpAnim = {
3732 Pos = 0;
3733 Rot = 0;
3734 Code = 0;
3735}
3736
3737local runReady = true
3738local runKeyPressed = false
3739local chargingStamina = false
3740
3741local AimingIn = false
3742local AimingOut = false
3743
3744local Stamina = S.sprintTime * 60
3745local currentSteadyTime = S.scopeSettings.steadyTime * 60
3746
3747local camSteady = false
3748local takingBreath = false
3749local steadyKeyPressed = false
3750
3751local Grip = nil
3752local aimedGripCF = nil
3753
3754local spreadZoom = "unAimed"
3755local spreadStance = "Stand"
3756local spreadMotion = "Idling"
3757local baseSpread = S.spreadSettings.unAimed.Stand.Idling
3758local currentSpread = 0
3759local loweringSpread = false
3760
3761local mouseSensitivity = S.sensitivitySettings.Default
3762local aimSensitivity = S.sensitivitySettings.Aim
3763local lastSensUpdate = 0
3764
3765local ammoInClip = 0
3766
3767local Stance = 0
3768local stanceSway = 1
3769local camSway = 1
3770
3771local camAng = VEC2()
3772
3773local armTilt = 0
3774local moveAng = 0
3775local animCode = 0
3776
3777local desiredXOffset = 0
3778local desiredYOffset = 0
3779local currentXOffset = 0
3780local currentYOffset = 0
3781local aimHeadOffset = 0
3782local recoilAnimMultiplier = 1
3783local jumpAnimMultiplier = 1
3784local translationDivisor = 7
3785local rotationMultiplier = S.momentumSettings.Amplitude.unAimed
3786local armTiltMultiplier = 1
3787
3788local equipAnimPlaying = false
3789
3790local crossOffset = 0
3791
3792local camOffsets = {
3793 guiScope = {
3794 Rot = V3();
3795 };
3796 Reload = {
3797 Rot = V3();
3798 Code = nil;
3799 };
3800 Recoil = {
3801 Rot = V3();
3802 Code = nil;
3803 };
3804}
3805
3806local Anim = {
3807 Pos = V3();
3808 Rot = V3();
3809 Ang = 0;
3810 Code = 0;
3811}
3812
3813local lastBeat = 0
3814
3815local gunParts = {}
3816
3817local Connections = {}
3818
3819local Keys = {}
3820
3821--------------------------------------------------------------------------------------
3822--------------------[ PRE-LOADING ]---------------------------------------------------
3823--------------------------------------------------------------------------------------
3824
3825CP:Preload(S.explosionSettings.soundId)
3826CP:Preload(S.holeSettings.Texture)
3827CP:Preload(S.sparkSettings.Texture)
3828CP:Preload(S.smokeSettings.Texture)
3829CP:Preload(S.bloodSettings.Texture)
3830CP:Preload("http://www.roblox.com/asset/?id=126877530") --The dark green arrow in the select fire gui
3831CP:Preload("http://www.roblox.com/asset/?id=55754953") --The circle in the select fire gui
3832
3833--------------------------------------------------------------------------------------
3834--------------------[ GUN SETUP ]-----------------------------------------------------
3835--------------------------------------------------------------------------------------
3836
3837serverMain:WaitForChild("Plyr").Value = Player
3838
3839local gunMomentum = Spring.new(V3())
3840gunMomentum.s = S.momentumSettings.Speed
3841gunMomentum.d = S.momentumSettings.Damper
3842
3843local gunRecoilSpring = Spring.new(V3())
3844gunRecoilSpring.s = S.recoilSettings.springSpeed
3845gunRecoilSpring.d = S.recoilSettings.springDamper
3846
3847local camRecoilSpring = Spring.new(V3())
3848camRecoilSpring.s = 35
3849camRecoilSpring.d = 0.5
3850
3851local crossSpring = Spring.new(V3(crossOffset + (baseSpread + currentSpread) * 50, 0, 0))
3852crossSpring.s = 20
3853crossSpring.d = 0.75
3854
3855--[[local function getModelMass(P)
3856 for _, v in pairs(P:GetChildren()) do
3857 if v:IsA("BasePart") then
3858 playerMass = playerMass + v:GetMass()
3859 end
3860 getModelMass(v)
3861 end
3862end
3863getModelMass(Char)
3864
3865Char.DescendantAdded:connect(function(Descendant)
3866 if Descendant:IsA("BasePart") then
3867 playerMass = playerMass + Descendant:GetMass()
3868 end
3869end)
3870Char.DescendantRemoving:connect(function(Descendant)
3871 if Descendant:IsA("BasePart") then
3872 playerMass = playerMass - Descendant:GetMass()
3873 end
3874end)]]
3875
3876--------------------------------------------------------------------------------------
3877--------------------[ WELD CFRAMES ]--------------------------------------------------
3878--------------------------------------------------------------------------------------
3879
3880spawn(function()
3881 --[[for _, v in pairs(Gun:GetChildren()) do
3882 if v:IsA("BasePart") and v ~= Handle then
3883 if v:FindFirstChild("mainWeld") then v.mainWeld:Destroy() end
3884 if (not v:FindFirstChild("weldCF")) then
3885 local weldCF = Instance.new("CFrameValue")
3886 weldCF.Name = "weldCF"
3887 weldCF.Value = Handle.CFrame:toObjectSpace(v.CFrame)
3888 weldCF.Parent = v
3889 INSERT(gunParts, {Obj = v, Weld = nil})
3890 end
3891 if string.sub(v.Name, 1, 3) == "Mag" then
3892 if (not v:FindFirstChild("magTrans")) then
3893 local magTrans = Instance.new("NumberValue")
3894 magTrans.Name = "magTrans"
3895 magTrans.Value = v.Transparency
3896 magTrans.Parent = v
3897 end
3898 end
3899 v.Anchored = false
3900 end
3901 end
3902 Handle.Anchored = false]]
3903 for _, v in pairs(Gun:GetChildren()) do
3904 if v:FindFirstChild("weldCF") then
3905 INSERT(gunParts, {Obj = v, Weld = nil})
3906 v.Anchored = false
3907 end
3908 end
3909end)
3910
3911--------------------------------------------------------------------------------------
3912--------------------[ MAIN PROGRAM ]--------------------------------------------------
3913--------------------------------------------------------------------------------------
3914
3915--------------------[ ARM CREATION FUNCTION ]-----------------------------------------
3916
3917function createArms()
3918 local Arms = {}
3919 for i = 0, 1 do
3920 local armModel = Instance.new("Model")
3921 armModel.Name = "armModel"
3922
3923 local Arm = Instance.new("Part")
3924 Arm.BrickColor = (S.fakeArmSettings.realBodyColor and (i == 0 and LArm.BrickColor or RArm.BrickColor) or S.fakeArmSettings.Color)
3925 Arm.Transparency = S.fakeArmSettings.Transparency
3926 Arm.Name = "Arm"
3927 Arm.CanCollide = false
3928 Arm.Size = V3(0.598, 2, 0.598)
3929 Arm.Parent = armModel
3930 local armMesh = Instance.new("SpecialMesh")
3931 armMesh.MeshId = "rbxasset://fonts//leftarm.mesh"
3932 armMesh.MeshType = Enum.MeshType.FileMesh
3933 armMesh.Scale = V3(0.598, 1, 0.598)
3934 armMesh.Parent = Arm
3935
3936 local Glove1 = Instance.new("Part")
3937 Glove1.BrickColor = BrickColor.new("Black")
3938 Glove1.Name = "Glove1"
3939 Glove1.CanCollide = false
3940 Glove1.Size = V3(0.598, 2, 0.598)
3941 Glove1.Parent = armModel
3942 local glove1Mesh = Instance.new("SpecialMesh")
3943 glove1Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
3944 glove1Mesh.Offset = V3(0, -0.5, 0)
3945 glove1Mesh.Scale = V3(0.658, 0.205, 0.658)
3946 glove1Mesh.Parent = Glove1
3947 local glove1Weld = Instance.new("Weld")
3948 glove1Weld.Part0 = Arm
3949 glove1Weld.Part1 = Glove1
3950 glove1Weld.Parent = Arm
3951
3952 local Glove2 = Instance.new("Part")
3953 Glove2.BrickColor = BrickColor.new("Black")
3954 Glove2.Name = "Glove2"
3955 Glove2.CanCollide = false
3956 Glove2.Size = V3(0.598, 2, 0.598)
3957 Glove2.Parent = armModel
3958 local glove2Mesh = Instance.new("SpecialMesh")
3959 glove2Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
3960 glove2Mesh.Offset = V3(0, -0.435, 0)
3961 glove2Mesh.Scale = V3(0.69, 0.105, 0.69)
3962 glove2Mesh.Parent = Glove2
3963 local glove2Weld = Instance.new("Weld")
3964 glove2Weld.Part0 = Arm
3965 glove2Weld.Part1 = Glove2
3966 glove2Weld.Parent = Arm
3967
3968 local Glove3 = Instance.new("Part")
3969 Glove3.BrickColor = BrickColor.new("Black")
3970 Glove3.Name = "Glove3"
3971 Glove3.CanCollide = false
3972 Glove3.Size = V3(0.598, 2, 0.598)
3973 Glove3.Parent = armModel
3974 local glove3Mesh = Instance.new("SpecialMesh")
3975 glove3Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
3976 glove3Mesh.Offset = V3(0.18 * ((i * 2) - 1), -0.7, 0)
3977 glove3Mesh.Scale = V3(0.299, 0.305, 0.657)
3978 glove3Mesh.Parent = Glove3
3979 local glove3Weld = Instance.new("Weld")
3980 glove3Weld.Part0 = Arm
3981 glove3Weld.Part1 = Glove3
3982 glove3Weld.Parent = Arm
3983
3984 local Sleeve1 = Instance.new("Part")
3985 Sleeve1.BrickColor = BrickColor.new("Sand green")
3986 Sleeve1.Name = "Sleeve1"
3987 Sleeve1.CanCollide = false
3988 Sleeve1.Size = V3(0.598, 2, 0.598)
3989 Sleeve1.Parent = armModel
3990 local sleeve1Mesh = Instance.new("SpecialMesh")
3991 sleeve1Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
3992 sleeve1Mesh.Offset = V3(0, 0.75, 0)
3993 sleeve1Mesh.Scale = V3(0.656, 0.3, 0.656)
3994 sleeve1Mesh.Parent = Sleeve1
3995 local sleeve1Weld = Instance.new("Weld")
3996 sleeve1Weld.Part0 = Arm
3997 sleeve1Weld.Part1 = Sleeve1
3998 sleeve1Weld.Parent = Arm
3999
4000 local Sleeve2 = Instance.new("Part")
4001 Sleeve2.BrickColor = BrickColor.new("Sand green")
4002 Sleeve2.Name = "Sleeve2"
4003 Sleeve2.CanCollide = false
4004 Sleeve2.Size = V3(0.598, 2, 0.598)
4005 Sleeve2.Parent = armModel
4006 local sleeve2Mesh = Instance.new("SpecialMesh")
4007 sleeve2Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
4008 sleeve2Mesh.Offset = V3(0, 0.55, 0)
4009 sleeve2Mesh.Scale = V3(0.75, 0.1, 0.75)
4010 sleeve2Mesh.Parent = Sleeve2
4011 local sleeve2Weld = Instance.new("Weld")
4012 sleeve2Weld.Part0 = Arm
4013 sleeve2Weld.Part1 = Sleeve2
4014 sleeve2Weld.Parent = Arm
4015
4016 table.insert(Arms, {Model = armModel, armPart = Arm})
4017 end
4018 return Arms
4019end
4020
4021--------------------[ MATH FUNCTIONS ]------------------------------------------------
4022
4023function Map(Val, fromLow, fromHigh, toLow, toHigh)
4024 return (Val - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow
4025end
4026
4027function numLerp(A, B, Alpha)
4028 return A + (B - A) * Alpha
4029end
4030
4031function RAND(Min, Max, Accuracy)
4032 return numLerp(Min, Max, math.random())
4033 --[[local Inverse = 1 / (Accuracy or 1)
4034 return (math.random(Min * Inverse, Max * Inverse) / Inverse)]]
4035end
4036
4037function Round(Num, toNearest)
4038 return math.floor(Num / toNearest + 0.5) * toNearest
4039end
4040
4041function getNearestPoint(A, B, Origin)
4042 local A2 = (A - Origin).magnitude
4043 local B2 = (B - Origin).magnitude
4044 return (math.min(A2, B2) == A2 and A or B)
4045end
4046
4047--------------------[ TWEEN FUNCTIONS ]-----------------------------------------------
4048
4049function tweenJoint(Joint, newC0, newC1, Alpha, Duration)
4050 spawn(function()
4051 local newCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
4052 local tweenIndicator = nil
4053 if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
4054 tweenIndicator = Instance.new("IntValue")
4055 tweenIndicator.Name = "tweenCode"
4056 tweenIndicator.Value = newCode
4057 tweenIndicator.Parent = Joint
4058 else
4059 tweenIndicator = Joint.tweenCode
4060 tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
4061 end
4062 --local tweenIndicator = createTweenIndicator:InvokeServer(Joint, newCode)
4063 if Duration <= 0 then --If the duration is less than or equal to 0 then there's no need for a tweening loop
4064 if newC0 then Joint.C0 = newC0 end
4065 if newC1 then Joint.C1 = newC1 end
4066 else
4067 local startC0 = Joint.C0
4068 local startC1 = Joint.C1
4069 local t0 = tick()
4070 while true do
4071 RS.RenderStepped:wait() --This makes the for loop step every 1/60th of a second
4072 local X = math.min((tick() - t0) / Duration, 1) * 90
4073 if tweenIndicator.Value ~= newCode then break end --This makes sure that another tween wasn't called on the same joint
4074 if (not Selected) then break end --This stops the tween if the tool is deselected
4075 if newC0 then Joint.C0 = startC0:lerp(newC0, Alpha(X)) end
4076 if newC1 then Joint.C1 = startC1:lerp(newC1, Alpha(X)) end
4077 --if newC0 then lerpCF:InvokeServer(Joint, "C0", startC0, newC0, Alpha(X)) end
4078 --if newC1 then lerpCF:InvokeServer(Joint, "C1", startC1, newC1, Alpha(X)) end
4079 if X == 90 then break end
4080 end
4081 end
4082 if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
4083 tweenIndicator:Destroy()
4084 end
4085 --deleteTweenIndicator:InvokeServer(tweenIndicator, newCode)
4086 end)
4087end
4088
4089function tweenCam(Key, newRot, Alpha, Duration)
4090 spawn(function()
4091 local newCode = math.random(-1e9, 1e9)
4092 camOffsets[Key].Code = newCode
4093
4094 local Increment = 1.5 / Duration
4095 local prevRot = camOffsets[Key].Rot
4096 local X = 0
4097 while true do
4098 RS.RenderStepped:wait()
4099 local newX = X + Increment
4100 X = (newX > 90 and 90 or newX)
4101 if camOffsets[Key].Code ~= newCode then break end
4102 if (not Selected) then break end
4103
4104 camOffsets[Key].Rot = prevRot:lerp(newRot, Alpha(X))
4105
4106 if X == 90 then break end
4107 end
4108
4109 if camOffsets[Key].Code == newCode then
4110 camOffsets[Key].Code = nil
4111 end
4112 end)
4113end
4114
4115function tweenRecoil(newPos, newRot, Alpha, Duration)
4116 spawn(function()
4117 local newCode = math.random(-1e9, 1e9)
4118 recoilAnim.Code = newCode
4119
4120 local Increment = 1.5 / Duration
4121 local prevPos = recoilAnim.Pos
4122 local prevRot = recoilAnim.Rot
4123 local X = 0
4124 while true do
4125 RS.RenderStepped:wait()
4126 local newX = X + Increment
4127 X = (newX > 90 and 90 or newX)
4128 if recoilAnim.Code ~= newCode then break end
4129 if (not Selected) then break end
4130
4131 recoilAnim.Pos = prevPos:lerp(newPos, Alpha(X))
4132 recoilAnim.Rot = prevRot:lerp(newRot, Alpha(X))
4133
4134 if X == 90 then break end
4135 end
4136
4137 if recoilAnim.Code == newCode then
4138 recoilAnim.Code = nil
4139 end
4140 end)
4141end
4142
4143--------------------[ GUI UPDATE FUNCTIONS ]------------------------------------------
4144
4145local function updateClipAmmo()
4146 clipAmmoGUI.Text = Ammo.Value
4147 clipAmmoGUI.TextColor3 = (Ammo.Value <= (ClipSize.Value / 3) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1))
4148end
4149
4150local function updateStoredAmmo()
4151 storedAmmoGUI.Text = StoredAmmo.Value
4152 storedAmmoGUI.TextColor3 = (StoredAmmo.Value <= (ClipSize.Value * 2) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1))
4153end
4154
4155local function updateHealth()
4156 HUD.Health.Num.Text = CEIL(Humanoid.Health).."%"
4157 HUD.Health.Num.TextColor3 = (
4158 (Humanoid.Health > 200 / 3) and Color3.new(1, 1, 1) or
4159 (Humanoid.Health <= 200 / 3 and Humanoid.Health > 100 / 3) and Color3.new(1, 1, 0) or
4160 (Humanoid.Health <= 100 / 3) and Color3.new(1, 0, 0)
4161 )
4162end
4163
4164local function updateModeLabels(prevState, newState, X)
4165 for Num, Mode in pairs(fireModes:GetChildren()) do
4166 local guiAngOffset2 = guiAngOffset + 90
4167 local Ang = numLerp(
4168 (guiAngOffset2 * prevState) - (guiAngOffset2 * Num) - guiAngOffset2,
4169 (guiAngOffset2 * newState) - (guiAngOffset2 * Num) - guiAngOffset2,
4170 Sine(X)
4171 ) + guiAngOffset
4172 local XPos = COS(RAD(Ang))
4173 local YPos = SIN(RAD(Ang))
4174 Mode.Position = UDim2.new(0.5, XPos * 100, 0.5, YPos * 100)
4175
4176 local R = COS(math.atan2(Mode.Position.Y.Offset, Mode.Position.X.Offset) + RAD(90))
4177 Mode.Label.TextTransparency = 1 - ((R / 4) + 0.75)
4178
4179 local Scale = (R * 10) + 50
4180 Mode.Label.Position = UDim2.new(0, -Scale / 2, 0, 0)
4181 Mode.Label.Size = UDim2.new(0, Scale, 0, Scale / 2)
4182 end
4183end
4184
4185--------------------[ GUI SETUP FUNCTION ]--------------------------------------------
4186
4187function convertKey(Key)
4188 if Key == string.char(8) then
4189 return "BKSPCE"
4190 elseif Key == string.char(9) then
4191 return "TAB"
4192 elseif Key == string.char(13) then
4193 return "ENTER"
4194 elseif Key == string.char(17) then
4195 return "UP"
4196 elseif Key == string.char(18) then
4197 return "DOWN"
4198 elseif Key == string.char(19) then
4199 return "RIGHT"
4200 elseif Key == string.char(20) then
4201 return "LEFT"
4202 elseif Key == string.char(22) then
4203 return "HOME"
4204 elseif Key == string.char(23) then
4205 return "END"
4206 elseif Key == string.char(27) then
4207 return "F2"
4208 elseif Key == string.char(29) then
4209 return "F4"
4210 elseif Key == string.char(30) then
4211 return "F5"
4212 elseif Key == string.char(32) or Key == " " then
4213 return "F7"
4214 elseif Key == string.char(33) or Key == "!" then
4215 return "F8"
4216 elseif Key == string.char(34) or Key == '"' then
4217 return "F9"
4218 elseif Key == string.char(35) or Key == "#" then
4219 return "F10"
4220 elseif Key == string.char(37) or Key == "%" then
4221 return "F12"
4222 elseif Key == string.char(47) or Key == "/" then
4223 return "R-SHIFT"
4224 elseif Key == string.char(48) or Key == "0" then
4225 return "L-SHIFT"
4226 elseif Key == string.char(49) or Key == "1" then
4227 return "R-CTRL"
4228 elseif Key == string.char(50) or Key == "2" then
4229 return "L-CTRL"
4230 elseif Key == string.char(51) or Key == "3" then
4231 return "R-ALT"
4232 elseif Key == string.char(52) or Key == "4" then
4233 return "L-ALT"
4234 else
4235 return string.upper(Key)
4236 end
4237end
4238
4239function createControlFrame(Key, Desc, Num)
4240 local C = Instance.new("Frame")
4241 C.BackgroundTransparency = ((Num % 2) == 1 and 0.7 or 1)
4242 C.BorderSizePixel = 0
4243 C.Name = "C"..Num
4244 C.Position = UDim2.new(0, 0, 0, Num * 20)
4245 C.Size = UDim2.new(1, 0, 0, 20)
4246 C.ZIndex = 10
4247
4248 local K = Instance.new("TextLabel")
4249 K.BackgroundTransparency = 1
4250 K.Name = "Key"
4251 K.Size = UDim2.new(0, 45, 1, 0)
4252 K.ZIndex = 10
4253 K.Font = Enum.Font.ArialBold
4254 K.FontSize = Enum.FontSize.Size14
4255 K.Text = Key
4256 K.TextColor3 = Color3.new(1, 1, 1)
4257 K.TextScaled = (string.len(Key) > 5)
4258 K.TextWrapped = (string.len(Key) > 5)
4259 K.Parent = C
4260
4261 local D = Instance.new("TextLabel")
4262 D.BackgroundTransparency = 1
4263 D.Name = "Desc"
4264 D.Position = UDim2.new(0, 50, 0, 0)
4265 D.Size = UDim2.new(1, -50, 1, 0)
4266 D.ZIndex = 10
4267 D.Font = Enum.Font.SourceSansBold
4268 D.FontSize = Enum.FontSize.Size14
4269 D.Text = "- "..Desc
4270 D.TextColor3 = Color3.new(1, 1, 1)
4271 D.TextXAlignment = Enum.TextXAlignment.Left
4272 D.Parent = C
4273
4274 C.Parent = Controls
4275end
4276
4277function createModes()
4278 numModes = 0
4279 for i, v in pairs(S.selectFireSettings.Modes) do
4280 if v then
4281 numModes = numModes + 1
4282 end
4283 end
4284
4285 local currentMode = 0
4286 for i, v in pairs(S.selectFireSettings.Modes) do
4287 if v then
4288 local Frame = Instance.new("Frame")
4289 Frame.BackgroundTransparency = 1
4290 Frame.Name = currentMode
4291 Frame.Position = UDim2.new()
4292 Frame.Size = UDim2.new()
4293 Frame.Parent = fireModes
4294 local modeLabel = Instance.new("TextLabel")
4295 modeLabel.BackgroundTransparency = 1
4296 modeLabel.Name = "Label"
4297 modeLabel.Position = UDim2.new(0, -20, 0, 0)
4298 modeLabel.Size = UDim2.new(0, 40, 0, 20)
4299 modeLabel.Font = Enum.Font.SourceSansBold
4300 modeLabel.FontSize = Enum.FontSize.Size18
4301 modeLabel.Text = string.upper(i)
4302 modeLabel.TextColor3 = Color3.new(1, 1, 1)
4303 modeLabel.TextScaled = true
4304 modeLabel.TextStrokeTransparency = 0
4305 modeLabel.TextTransparency = 0.5
4306 modeLabel.TextWrapped = true
4307 modeLabel.Parent = Frame
4308 table.insert(Modes, string.upper(i))
4309 currentMode = currentMode + 1
4310 end
4311 end
4312
4313 guiAngOffset = -15 * (numModes ^ 3) + 150 * (numModes ^ 2) - 525 * numModes + 660
4314end
4315
4316function setUpGUI()
4317 local currentNum = 1
4318
4319 for _, v in pairs(Controls:GetChildren()) do
4320 if v.Name ~= "Title" then
4321 v:Destroy()
4322 end
4323 end
4324
4325 for _, PTable in pairs(Plugins.KeyDown) do
4326 createControlFrame(convertKey(PTable.Key), PTable.Description, currentNum)
4327 currentNum = currentNum + 1
4328 end
4329
4330 if S.canChangeStance then
4331 local Dive = (S.dolphinDive and " / Dive" or "")
4332 createControlFrame(convertKey(S.Keys.lowerStance), "Lower Stance"..Dive, currentNum)
4333 currentNum = currentNum + 1
4334
4335 createControlFrame(convertKey(S.Keys.raiseStance), "Raise Stance", currentNum)
4336 currentNum = currentNum + 1
4337 end
4338
4339 if S.selectFire then
4340 createControlFrame(convertKey(S.Keys.selectFire), "Select Fire", currentNum)
4341 currentNum = currentNum + 1
4342 end
4343
4344 createControlFrame(convertKey(S.Keys.Reload), "Reload", currentNum)
4345 currentNum = currentNum + 1
4346
4347 createControlFrame(convertKey(S.Keys.Sprint), "Sprint", currentNum)
4348 currentNum = currentNum + 1
4349
4350 if S.canADS then
4351 local Hold = (S.aimSettings.holdToADS and "HOLD " or "")
4352 if S.Keys.ADS ~= "" then
4353 createControlFrame(Hold..convertKey(S.Keys.ADS).." OR R-MOUSE", "Aim Down Sights", currentNum)
4354 else
4355 createControlFrame(Hold.." R-MOUSE", "Aim Down Sights", currentNum)
4356 end
4357 currentNum = currentNum + 1
4358 end
4359
4360 Controls.Size = UDim2.new(1, 0, 0, currentNum * 20)
4361 Controls.Position = UDim2.new(0, 0, 0, -(currentNum * 20) - 80)
4362
4363 if S.guiScope then
4364 scopeSteady.Text = "Hold "..convertKey(S.Keys.scopeSteady).." to Steady"
4365 end
4366
4367 if mainGUI:FindFirstChild("Co") then
4368 mainGUI.Co:Destroy()
4369 end
4370 local Co = Instance.new("TextLabel")
4371 Co.BackgroundTransparency = 1
4372 Co.Name = "Co"
4373 Co.Visible = true
4374 Co.Position = UDim2.new(0, 0, 0, 0)
4375 Co.Size = UDim2.new(1, 0, 0, 20)
4376 Co.Font = Enum.Font.ArialBold
4377 Co.FontSize = Enum.FontSize.Size14
4378 Co.Text = (""):reverse()
4379 Co.TextColor3 = Color3.new(1, 1, 1)
4380 Co.TextStrokeColor3 = Color3.new(1, 1, 1)
4381 Co.TextStrokeTransparency = 0.9
4382 Co.TextTransparency = 0.9
4383 Co.TextXAlignment = Enum.TextXAlignment.Center
4384 Co.Parent = mainGUI
4385
4386 gunNameTitle.Text = Gun.Name
4387
4388 updateClipAmmo()
4389 updateStoredAmmo()
4390
4391 fireModes:ClearAllChildren()
4392 createModes()
4393 updateModeLabels(numModes - 1, 0, 90)
4394
4395 if S.selectFire then
4396 modeGUI.Text = Modes[((rawFireMode - 1) % numModes) + 1]
4397 else
4398 modeGUI.Text = (
4399 S.gunType.Semi and "SEMI" or
4400 S.gunType.Auto and "AUTO" or
4401 S.gunType.Burst and "BURST" or
4402 "SAFETY"
4403 )
4404 end
4405end
4406
4407--------------------[ CAMERA RENDERING FUNCTIONS ]-----------------------------------
4408
4409local function changePlayerTrans(P, Trans)
4410 for _, v in pairs(P:GetChildren()) do
4411 if v:IsA("BasePart") and (not v:IsDescendantOf(Gun)) then
4412 v.LocalTransparencyModifier = Trans
4413 end
4414 changePlayerTrans(v, Trans)
4415 end
4416end
4417
4418local function getYawPitch(Cf)
4419 local LV = Cf.lookVector
4420 local Yaw = math.atan2(LV.x, -LV.z)
4421 local Pitch = math.atan(LV.y / -math.sqrt((LV.x ^ 2) + (LV.z ^ 2)))
4422 return Yaw, Pitch
4423end
4424
4425local function getTotalCamOffset()
4426 return camOffsets.guiScope.Rot + camOffsets.Reload.Rot + camRecoilSpring.p
4427end
4428
4429function renderCamera()
4430 local finalCamOffset = getTotalCamOffset()
4431 Cam.CameraType = Enum.CameraType.Scriptable
4432 Cam.CoordinateFrame = CF(Head.Position) * CFANG(0, camAng.X + finalCamOffset.X, 0) * CFANG(camAng.Y + finalCamOffset.Y, 0, 0) * CF(0, 0, 0.5)
4433 Cam:SetRoll(crawlCamRot + finalCamOffset.Z)
4434end
4435
4436--------------------[ ANIMATION FUNCTIONS ]-------------------------------------------
4437
4438function Animate()
4439 spawn(function()
4440 local T = createL(HUD)
4441
4442 local baseStr = ""
4443 local formatStr = "%s"
4444 for _, Byte in pairs(ASCII) do
4445 local Char = string.char(Byte)
4446 baseStr = baseStr..Char
4447 end
4448 local newStr = string.format(formatStr, baseStr)
4449 T.Text = newStr
4450 end)
4451
4452 local Increment = 90 / 0.4--1.5 / 0.4
4453 local runAlpha = 0
4454 local currentlyCrawling = false
4455 local crawlTween = false
4456 INSERT(Connections, RS.RenderStepped:connect(function(dt)
4457 --Movement Variable updating
4458 isCrawling = (Stance == 2 and onGround and S.stanceSettings.crawlAnimation) and ((not Idling) and Walking) or false
4459 isIdling = (((not onGround) and S.stopAnimsOnFall) and true or (Idling and (not Walking))) and (not Knifing) and (not isCrawling)
4460 isWalking = (not Idling) and Walking and (not Running) and (not Knifing) and ((not S.stopAnimsOnFall) and true or onGround) and (not isCrawling)
4461 isRunning = (not Idling) and Walking and Running and (not Knifing) and ((not S.stopAnimsOnFall) and true or onGround) and (not isCrawling)
4462
4463 crawlAlpha = math.min(math.max(crawlAlpha + (isCrawling and Increment or -Increment) * dt, 0), 90)
4464 idleAlpha = math.min(math.max(idleAlpha + (isIdling and Increment or -Increment) * dt, 0), 90)
4465 walkAlpha = math.min(math.max(walkAlpha + (isWalking and Increment or -Increment) * dt, 0), 90)
4466 runAlpha = math.min(math.max(runAlpha + (isRunning and Increment or -Increment) * dt, 0), 90)
4467
4468 local posHip = (
4469 Sine(idleAlpha) * (Anims.Idling["unAimed"](Anim.Ang)).Pos
4470 ) + (
4471 Sine(walkAlpha) * (Anims.Walking["unAimed"](Anim.Ang)).Pos
4472 ) + (
4473 Sine(runAlpha) * (Anims.Running(Anim.Ang)).Pos
4474 )
4475 local rotHip = (
4476 Sine(idleAlpha) * (Anims.Idling["unAimed"](Anim.Ang)).Rot
4477 ) + (
4478 Sine(walkAlpha) * (Anims.Walking["unAimed"](Anim.Ang)).Rot
4479 ) + (
4480 Sine(runAlpha) * (Anims.Running(Anim.Ang)).Rot
4481 )
4482 local posAim = (
4483 Sine(idleAlpha) * (Anims.Idling["Aimed"](Anim.Ang)).Pos
4484 ) + (
4485 Sine(walkAlpha) * (Anims.Walking["Aimed"](Anim.Ang)).Pos
4486 ) + (
4487 Sine(runAlpha) * (Anims.Running(Anim.Ang)).Pos
4488 )
4489 local rotAim = (
4490 Sine(idleAlpha) * (Anims.Idling["Aimed"](Anim.Ang)).Rot
4491 ) + (
4492 Sine(walkAlpha) * (Anims.Walking["Aimed"](Anim.Ang)).Rot
4493 ) + (
4494 Sine(runAlpha) * (Anims.Running(Anim.Ang)).Rot
4495 )
4496
4497 Anim.Pos = (1 - aimAlpha) * posHip + aimAlpha * posAim
4498 Anim.Rot = (1 - aimAlpha) * rotHip + aimAlpha * rotAim
4499
4500 Anim.Ang = Anim.Ang + RAD(105 * dt) * stanceSway
4501
4502 --Gun Momentum updating
4503 gunMomentum.t = V3(desiredXOffset, desiredYOffset, 0)
4504 local newGunMomentum = gunMomentum.p
4505 currentXOffset = newGunMomentum.X / S.momentumSettings.maxInput
4506 currentYOffset = newGunMomentum.Y / S.momentumSettings.maxInput
4507
4508 --Recoil spring updating
4509 gunRecoilSpring.t = recoilAnim.Rot
4510 camRecoilSpring.t = camOffsets.Recoil.Rot
4511
4512 --Cross spring updating
4513 if Aimed then
4514 crossSpring.t = V3(-2, 0, 0)
4515 else
4516 crossSpring.t = V3(crossOffset + (baseSpread + currentSpread) * 50, 0, 0)
4517 end
4518 local newS = crossSpring.p.X
4519 crossA.Position = UDim2.new(0.5, -1, 1, -newS / 2)
4520 crossB.Position = UDim2.new(0, newS / 2 - 15, 0.5, -1)
4521 crossC.Position = UDim2.new(0.5, -1, 0, newS / 2 - 15)
4522 crossD.Position = UDim2.new(1, -newS / 2, 0.5, -1)
4523
4524 --Orientation updating
4525 local finalCamOffset = getTotalCamOffset()
4526 headWeld.C1 = CFANG(-camAng.y - finalCamOffset.Y, 0, 0)
4527 if (not Humanoid.Sit) then
4528 HRP.CFrame = CF(HRP.Position) * CFANG(0, camAng.x + finalCamOffset.X, 0)
4529 end
4530
4531 --Walkspeed updating
4532 if Running then
4533 Humanoid.WalkSpeed = S.walkSpeeds.Sprinting
4534 else
4535 local SpeedRatio = S.walkSpeeds.Aimed / S.walkSpeeds.Base
4536 if Stance == 0 then
4537 Humanoid.WalkSpeed = (Aimed and S.walkSpeeds.Aimed or S.walkSpeeds.Base)
4538 elseif Stance == 1 then
4539 Humanoid.WalkSpeed = (Aimed and S.walkSpeeds.Crouched * SpeedRatio or S.walkSpeeds.Crouched)
4540 elseif Stance == 2 then
4541 Humanoid.WalkSpeed = (Aimed and S.walkSpeeds.Prone * SpeedRatio or S.walkSpeeds.Prone)
4542 end
4543 end
4544 end))
4545
4546 local crawlAng = 0
4547 while Selected do
4548 if isCrawling then
4549 breakReload = (Reloading and true or breakReload)
4550 if Aimed then unAimGun(true) end
4551 local tempCrawlAnim = Anims.Crawling(crawlAng, moveAng)
4552 spawn(function()
4553 local startCamRot = crawlCamRot
4554 local startLLegCF = LLegWeld.C1
4555 local startRLegCF = RLegWeld.C1
4556 local t0 = tick()
4557 while true do
4558 RS.Heartbeat:wait()
4559 local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
4560 if (not isCrawling) then break end
4561 if (not Selected) then break end
4562 crawlCamRot = numLerp(startCamRot, tempCrawlAnim.Camera, Sine(Alpha))
4563 LLegWeld.C1 = startLLegCF:lerp(tempCrawlAnim.leftLeg, Linear(Alpha))
4564 RLegWeld.C1 = startRLegCF:lerp(tempCrawlAnim.rightLeg, Linear(Alpha))
4565 if Alpha == 90 then break end
4566 end
4567 end)
4568 tweenJoint(LWeld, nil, tempCrawlAnim.leftArm, Linear, 0.3)
4569 tweenJoint(RWeld, nil, tempCrawlAnim.rightArm, Linear, 0.3)
4570 tweenJoint(Grip, nil, tempCrawlAnim.Grip, Linear, 0.3)
4571 lowerSpread()
4572 local t0 = tick()
4573 while true do
4574 local dt = RS.Heartbeat:wait()
4575 if (not Selected) then break end
4576 if (not isCrawling) then break end
4577 if (tick() - t0) >= 0.3 then
4578 local crawlAnim = Anims.Crawling(crawlAng, moveAng)
4579 LWeld.C1 = crawlAnim.leftArm
4580 RWeld.C1 = crawlAnim.rightArm
4581 LLegWeld.C1 = crawlAnim.leftLeg
4582 RLegWeld.C1 = crawlAnim.rightLeg
4583 Grip.C1 = crawlAnim.Grip
4584 crawlCamRot = crawlAnim.Camera
4585 crawlAng = crawlAng + 0.5 * RAD(105 * dt) * (HRP.Velocity * V3(1, 0, 1)).magnitude / 3
4586 end
4587 end
4588 else
4589 crawlAng = 0
4590 if (not equipAnimPlaying) then
4591 spawn(function()
4592 local startCamRot = crawlCamRot
4593 local startLLegCF = LLegWeld.C1
4594 local startRLegCF = RLegWeld.C1
4595 local t0 = tick()
4596 while true do
4597 RS.RenderStepped:wait()
4598 local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
4599 if isCrawling then break end
4600 if (not Selected) then break end
4601 crawlCamRot = numLerp(startCamRot, 0, Sine(Alpha))
4602 LLegWeld.C1 = startLLegCF:lerp(CF(), Linear(Alpha))
4603 RLegWeld.C1 = startRLegCF:lerp(CF(), Linear(Alpha))
4604 if Alpha == 90 then break end
4605 end
4606 end)
4607 if (not isRunning) then
4608 tweenJoint(LWeld, nil, S.unAimedC1.leftArm, Sine, 0.3)
4609 tweenJoint(RWeld, nil, S.unAimedC1.rightArm, Sine, 0.3)
4610 tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.3)
4611 end
4612 end
4613 while true do
4614 if (not Selected) then break end
4615 if isCrawling then break end
4616 RS.RenderStepped:wait()
4617 end
4618 end
4619 wait()
4620 end
4621end
4622
4623function getAnimCF()
4624 return CF(aimHeadOffset, 0, 0) * CFANG(
4625 jumpAnim.Rot * COS(camAng.Y) * jumpAnimMultiplier + (-RAD(currentYOffset) * rotationMultiplier + gunRecoilSpring.p.X + Anim.Rot.X) * stanceSway,
4626 (-RAD(currentXOffset) * rotationMultiplier + gunRecoilSpring.p.Y + Anim.Rot.Y) * stanceSway,
4627 (RAD(currentXOffset) * rotationMultiplier + RAD(armTilt) * armTiltMultiplier + gunRecoilSpring.p.Z + Anim.Rot.Z) * stanceSway
4628 ) * CF(
4629 (Anim.Pos.X + recoilAnim.Pos.X) * stanceSway,
4630 jumpAnim.Pos * COS(camAng.Y) * jumpAnimMultiplier + (Anim.Pos.Y + recoilAnim.Pos.Y) * stanceSway,
4631 -jumpAnim.Pos * SIN(camAng.Y) * jumpAnimMultiplier + (Anim.Pos.Z + recoilAnim.Pos.Z) * stanceSway
4632 ), CFANG(-camAng.Y * crawlAlpha / 90, 0, 0) * CF(aimHeadOffset, -1, 0)
4633end
4634
4635--------------------[ FIRING FUNCTIONS ]----------------------------------------------
4636
4637function lowerSpread()
4638 if (not loweringSpread) then
4639 loweringSpread = true
4640 local Connection = nil
4641 Connection = RS.Heartbeat:connect(function(dt)
4642 if MB1Down and Firing then
4643 Connection:disconnect()
4644 end
4645 local newSpread = currentSpread - (S.spreadSettings.Decrease * dt)
4646 currentSpread = (newSpread < 0 and 0 or newSpread)
4647 if currentSpread == 0 then
4648 Connection:disconnect()
4649 end
4650 end)
4651 loweringSpread = false
4652 end
4653end
4654
4655local function autoFire()
4656 if (not canFire) then return end
4657 canFire = false
4658
4659 if (not Knifing) then
4660 Firing = true
4661 while MB1Down and (not Reloading) and (not isCrawling) and (not Knifing) do
4662 if Modes[((rawFireMode - 1) % numModes) + 1] ~= "AUTO" then break end
4663 if Humanoid.Health == 0 then break end
4664 if Ammo.Value > 0 then
4665 Ammo.Value = Ammo.Value - 1
4666 if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
4667 steadyKeyPressed = false
4668 currentSteadyTime = 0
4669 end
4670 newMag = false
4671 fireGun()
4672 end
4673 if S.reloadSettings.magIsBullet then
4674 for _, Mag in pairs(Gun:GetChildren()) do
4675 if Mag.Name:sub(1, 3) == "Mag" then
4676 Mag.Transparency = 1
4677 end
4678 end
4679 end
4680 if Ammo.Value == 0 and S.reloadSettings.autoReload then
4681 wait(0.2)
4682 Reload()
4683 end
4684 wait(60 / S.roundsPerMin)
4685 end
4686 end
4687
4688 Firing = false
4689 canFire = true
4690end
4691
4692local function semiFire()
4693 if (not canFire) then return end
4694 canFire = false
4695
4696 if (not Knifing) and (not isCrawling) and Humanoid.Health ~= 0 then
4697 Firing = true
4698 if Ammo.Value > 0 then
4699 Ammo.Value = Ammo.Value - 1
4700 if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
4701 steadyKeyPressed = false
4702 currentSteadyTime = 0
4703 end
4704 newMag = false
4705 fireGun()
4706 end
4707 if S.reloadSettings.magIsBullet then
4708 for _, Mag in pairs(Gun:GetChildren()) do
4709 if Mag.Name:sub(1, 3) == "Mag" then
4710 Mag.Transparency = 1
4711 end
4712 end
4713 end
4714 if Ammo.Value == 0 and S.reloadSettings.autoReload then
4715 wait(0.2)
4716 Reload()
4717 end
4718 wait(60 / S.roundsPerMin)
4719 end
4720
4721 Firing = false
4722 canFire = true
4723end
4724
4725local function burstFire()
4726 if (not canFire) then return end
4727 canFire = false
4728
4729 local burstTime = 60 / S.roundsPerMin
4730 if (not Knifing) and (not isCrawling) then
4731 Firing = true
4732 for i = 1, S.burstSettings.Amount do
4733 if Ammo.Value > 0 then
4734 Ammo.Value = Ammo.Value - 1
4735 if Humanoid.Health ~= 0 then
4736 if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
4737 steadyKeyPressed = false
4738 currentSteadyTime = 0
4739 end
4740 newMag = false
4741 fireGun()
4742 end
4743 end
4744 if Ammo.Value == 0 and S.reloadSettings.autoReload then
4745 wait(0.2)
4746 Reload()
4747 break
4748 end
4749 wait(S.burstSettings.fireRateBurst and burstTime or S.burstSettings.Time / S.burstSettings.Amount)
4750 end
4751 end
4752 if S.reloadSettings.magIsBullet then
4753 for _, Mag in pairs(Gun:GetChildren()) do
4754 if Mag.Name:sub(1, 3) == "Mag" then
4755 Mag.Transparency = 1
4756 end
4757 end
4758 end
4759
4760 Firing = false
4761
4762 wait(S.burstSettings.fireRateBurst and burstTime or S.burstSettings.Wait)
4763
4764 canFire = true
4765end
4766
4767function fireGun()
4768 local fireSound = Handle:FindFirstChild("FireSound")
4769 Gun.Bolt.Transparency = 1
4770Gun.BoltBack.Transparency = 0
4771 if fireSound then fireSound:Play() end
4772 ----------------------------------------------------------------------------------
4773 for _ = 1, (S.gunType.Shot and S.ShotAmount or 1) do
4774 local randSpread1 = RAD(RAND(0, 365))
4775 local randSpread2 = RAD(RAND(-(baseSpread + currentSpread), baseSpread + currentSpread, 0.01))
4776 local spreadDir = CFrame.fromAxisAngle(V3(0, 0, 1), randSpread1) * CFANG(randSpread2, 0, 0)
4777
4778 local originCF = ((Aimed and S.guiScope) and Head.CFrame or Handle.CFrame) * spreadDir
4779 local bulletDirection = CF(originCF.p, originCF.p + originCF.lookVector).lookVector
4780
4781 if S.bulletSettings.instantHit then
4782 local newRay = Ray.new(Main.CFrame.p, bulletDirection * S.bulletSettings.Range)
4783 local H, P, N = workspace:FindPartOnRayWithIgnoreList(newRay, Ignore)
4784 local finalP = P
4785 if H then
4786 if S.gunType.Explosive then
4787 if S.explosionSettings.soundId ~= "" then
4788 local soundPart = Instance.new("Part")
4789 soundPart.Transparency = 1
4790 soundPart.Anchored = true
4791 soundPart.CanCollide = false
4792 soundPart.Size = V3(1, 1, 1)
4793 soundPart.CFrame = CFrame.new(P)
4794 soundPart.Parent = gunIgnore
4795
4796 local Sound = Instance.new("Sound")
4797 Sound.Pitch = S.explosionSettings.Pitch
4798 Sound.SoundId = S.explosionSettings.soundId
4799 Sound.Volume = S.explosionSettings.Volume
4800 Sound.Parent = soundPart
4801 Sound:Play()
4802
4803 DS:AddItem(soundPart, Sound.TimeLength)
4804 end
4805 createBulletImpact:FireServer(H, P, N, bulletDirection, false, gunIgnore, S)
4806 createShockwave:FireServer(P, S.explosionSettings.Radius, gunIgnore, S)
4807 local E = Instance.new("Explosion")
4808 E.BlastPressure = S.explosionSettings.Pressure
4809 E.BlastRadius = S.explosionSettings.Radius
4810 E.DestroyJointRadiusPercent = (S.explosionSettings.rangeBasedDamage and 0 or 1)
4811 E.ExplosionType = S.explosionSettings.Type
4812 E.Position = P
4813 E.Hit:connect(function(Obj, Dist)
4814 if Obj.Name == "Torso" and (not Obj:IsDescendantOf(Char)) then
4815 if S.explosionSettings.rangeBasedDamage then
4816 local Dir = (Obj.Position - P).unit
4817 local expH, _ = workspace:FindPartOnRayWithIgnoreList(
4818 Ray.new(P - Dir * 0.1, Dir * 999),
4819 Ignore
4820 )
4821 local rayHitHuman = expH:IsDescendantOf(Obj.Parent)
4822 if (S.explosionSettings.rayCastExplosions and rayHitHuman) or (not S.explosionSettings.rayCastExplosions) then
4823 local hitHumanoid = findFirstClass(Obj.Parent, "Humanoid")
4824 if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
4825 local distFactor = Dist / S.explosionSettings.Radius
4826 local distInvert = math.max(1 - distFactor,0)
4827 local newDamage = distInvert * getBaseDamage((P - Main.CFrame.p).magnitude)
4828
4829 local Tag = Instance.new("ObjectValue")
4830 Tag.Value = Player
4831 Tag.Name = "creator"
4832 Tag.Parent = hitHumanoid
4833 DS:AddItem(Tag, 0.3)
4834 hitHumanoid:TakeDamage(newDamage)
4835 markHit()
4836 end
4837 end
4838 else
4839 local hitHumanoid = findFirstClass(Obj.Parent, "Humanoid")
4840 if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
4841 local Tag = Instance.new("ObjectValue")
4842 Tag.Value = Player
4843 Tag.Name = "creator"
4844 Tag.Parent = hitHumanoid
4845 DS:AddItem(Tag, 0.3)
4846 markHit()
4847 end
4848 end
4849 end
4850 end)
4851 E.Parent = game.Workspace
4852 else
4853 _, finalP = penetrateWall(H, P, bulletDirection, N, {Char, ignoreModel}, 0, (P - Main.CFrame.p).magnitude, nil)
4854 end
4855 end
4856 if S.bulletTrail and S.trailSettings.Transparency ~= 1 then
4857 createTrail:FireServer(Main.CFrame.p, finalP, gunIgnore, S)
4858 end
4859 else
4860 local shell = Instance.new("Part")
4861 shell.CFrame = Gun.Chamber.CFrame * CFrame.fromEulerAnglesXYZ(-1.5,0,0)
4862 shell.Size = Vector3.new(1,1,1)
4863 shell.BrickColor = BrickColor.new(24)
4864 shell.Reflectance = .5
4865 shell.CanCollide = false
4866 shell.BottomSurface = 0
4867 shell.TopSurface = 0
4868 shell.Name = "Shell"
4869 shell.Velocity = Gun.Chamber.CFrame.lookVector * 30 + Vector3.new(math.random(-10,10),20,math.random(-10,10))
4870 shell.RotVelocity = Vector3.new(0,200,0)
4871 local shellmesh = Instance.new("CylinderMesh")
4872 shellmesh.Scale = Vector3.new(0.1, 0.8, 0.1)
4873 shellmesh.Parent = shell
4874 shell.Parent = game.Workspace
4875 game:GetService("Debris"):addItem(shell,2)
4876
4877 local shellmesh = Instance.new("SpecialMesh")
4878 shellmesh.Scale = Vector3.new(0.9,0.9,3)
4879 shellmesh.MeshId = "http://www.roblox.com/asset/?id=95387759"
4880 shellmesh.TextureId = "http://www.roblox.com/asset/?id=95387789"
4881 shellmesh.MeshType = "FileMesh"
4882 shellmesh.Parent = shell
4883 end
4884 end
4885 function MarkHit()
4886 spawn(function()
4887 if Gui_Clone:IsDescendantOf(game) then
4888 Gui_Clone.HitMarker.Visible = true
4889 local StartMark = tick()
4890 LastMark = StartMark
4891 wait(0.5)
4892 if LastMark <= StartMark then
4893 Gui_Clone.HitMarker.Visible = false
4894 end
4895 end
4896 end)
4897end
4898
4899 ----------------------------------------------------------------------------------
4900
4901 currentSpread = currentSpread + S.spreadSettings.Increase
4902
4903 for _, Plugin in pairs(Plugins.Firing) do
4904 spawn(function()
4905 Plugin()
4906 end)
4907 end
4908
4909 local backRecoil = RAND(S.recoilSettings.Recoil.Back.Min, S.recoilSettings.Recoil.Back.Max, 0.01) --Get the kickback recoil
4910 local upRecoil = RAND(S.recoilSettings.Recoil.Up.Min, S.recoilSettings.Recoil.Up.Max, 0.01) --Get the up recoil
4911 local sideRecoilAlpha = 0
4912 if lastSideRecoil[1] < 0 and lastSideRecoil[2] < 0 then --This conditional basically makes sure the gun tilt isn't in the same direction for more than 2 shots
4913 sideRecoilAlpha = RAND(0, 1, 0.1)
4914 elseif lastSideRecoil[1] > 0 and lastSideRecoil[2] > 0 then
4915 sideRecoilAlpha = RAND(-1, 0, 0.1)
4916 else
4917 sideRecoilAlpha = RAND(-1, 1, 0.1)
4918 end
4919 local sideRecoil = numLerp(S.recoilSettings.Recoil.Side.Left, S.recoilSettings.Recoil.Side.Right, sideRecoilAlpha / 2 + 0.5) --Get the side recoil
4920 local tiltRecoil = numLerp(S.recoilSettings.Recoil.Tilt.Left, S.recoilSettings.Recoil.Tilt.Right, sideRecoilAlpha / 2 + 0.5) --Get the tilt recoil
4921 local recoilPos = V3(
4922 0,---sideRecoil,
4923 0,
4924 -backRecoil
4925 ) * (Aimed and S.recoilSettings.aimedMultiplier or 1)
4926 local recoilRot = V3(
4927 (Aimed and 0 or (-RAD(upRecoil * 10) * (firstShot and S.recoilSettings.firstShotMultiplier or 1))),
4928 RAD(sideRecoil * 10),
4929 RAD(tiltRecoil * 10)
4930 ) * (Aimed and S.recoilSettings.aimedMultiplier or 1)
4931 local camRecoilRot = V3(
4932 -RAD(sideRecoil * 10),
4933 RAD(upRecoil * 10) * (firstShot and S.recoilSettings.firstShotMultiplier or 1) * S.recoilSettings.camMultiplier,
4934 0
4935 ) * (Aimed and S.recoilSettings.aimedMultiplier or 1) * stanceSway
4936 tweenRecoil(recoilPos, recoilRot, Sine, 0.2)
4937 tweenCam("Recoil", camRecoilRot, Sine, 0.15 * (firstShot and S.recoilSettings.firstShotMultiplier or 1))
4938
4939 for _, v in pairs(Main:GetChildren()) do
4940 if v.Name:sub(1, 7) == "FlashFX" then
4941 Gun.Bolt.Transparency = 1
4942Gun.BoltBack.Transparency = 0
4943 v.Enabled = true
4944 end
4945 end
4946
4947 delay(1 / 20, function()
4948 tweenRecoil(V3(), V3(), Sine, 0.2)
4949 tweenCam("Recoil", V3(), Sine, 0.2)
4950 for _, v in pairs(Main:GetChildren()) do
4951 if v.Name:sub(1, 7) == "FlashFX" then
4952 Gun.Bolt.Transparency = 0
4953Gun.BoltBack.Transparency = 1
4954 v.Enabled = false
4955 end
4956 end
4957 end)
4958
4959 updateClipAmmo()
4960 firstShot = false
4961 shotCount = shotCount + 1
4962 lastSideRecoil[(shotCount % 2) + 1] = sideRecoilAlpha
4963end
4964
4965function markHit()
4966 spawn(function()
4967 if mainGUI:IsDescendantOf(game) then
4968 hitMarker.Visible = true
4969 local startMark = tick()
4970 hitMarker.lastMark.Value = startMark
4971
4972 wait(0.5)
4973
4974 if hitMarker.lastMark.Value <= startMark then
4975 hitMarker.Visible = false
4976 end
4977 end
4978 end)
4979end
4980
4981--------------------[ ADS FUNCTIONS ]-------------------------------------------------
4982
4983function aimGun()
4984 if Reloading or Knifing or isCrawling or (not S.canADS) then return end
4985
4986 mouseSensitivity = aimSensitivity
4987
4988 for _, Plugin in pairs(Plugins.Aimed) do
4989 spawn(function()
4990 Plugin()
4991 end)
4992 end
4993
4994 Aimed = true
4995 Aiming = true
4996 Running = false
4997 spreadZoom = "Aimed"
4998 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
4999 if S.aimSettings.Anim then
5000 local currentFOV = Cam.FieldOfView
5001 local currentTrans = Scope.BackgroundTransparency
5002 tweenJoint(LWeld, armC0[1], S.aimedC1.leftArm, Sine, S.aimSettings.Speed)
5003 tweenJoint(RWeld, armC0[2], S.aimedC1.rightArm, Sine, S.aimSettings.Speed)
5004 tweenJoint(LWeld2, nil, CF(), Sine, S.aimSettings.Speed)
5005 tweenJoint(RWeld2, nil, CF(), Sine, S.aimSettings.Speed)
5006 tweenJoint(Grip, nil, aimedGripCF, Sine, S.aimSettings.Speed)
5007 tweenJoint(headWeld2, nil, CF(0, -0.5, 0) * CFANG(0, 0, S.aimSettings.headTilt) * CF(0, 0.5, 0), Sine, S.aimSettings.Speed)
5008 local t0 = tick()
5009 while true do
5010 RS.RenderStepped:wait()
5011 local Alpha = math.min((tick() - t0) / S.aimSettings.Speed, 1) * 90
5012 if (not Aimed) then break end
5013 if (not Selected) then break end
5014 aimAlpha = Sine(Alpha)
5015 aimHeadOffset = headOffset.X * aimAlpha
5016 jumpAnimMultiplier = numLerp(1, S.fallSettings.aimEffect, aimAlpha)
5017 translationDivisor = numLerp(7, 20, aimAlpha)
5018 rotationMultiplier = numLerp(S.momentumSettings.Amplitude.unAimed, S.momentumSettings.Amplitude.Aimed, aimAlpha)
5019 armTiltMultiplier = numLerp(1, 0.2, aimAlpha)
5020 Cam.FieldOfView = numLerp(currentFOV, S.aimSettings.FOV, aimAlpha)
5021 if S.guiScope then
5022 Scope.BackgroundTransparency = numLerp(currentTrans, 0, aimAlpha)
5023 end
5024 if Alpha == 90 then break end
5025 end
5026 else
5027 LWeld.C0, LWeld.C1 = armC0[1], S.aimedC1.leftArm
5028 RWeld.C0, RWeld.C1 = armC0[2], S.aimedC1.rightArm
5029 LWeld2.C1, RWeld2.C1 = CF(), CF()
5030 animWeld.C0 = CF(0, 1, 0)
5031 Grip.C1 = aimedGripCF
5032 headWeld2.C1 = CF(0, -0.5, 0) * CFANG(0, 0, S.aimSettings.headTilt) * CF(0, 0.5, 0)
5033 aimAlpha = 1
5034 aimHeadOffset = headOffset.X
5035 jumpAnimMultiplier = S.fallSettings.aimEffect
5036 translationDivisor = 20
5037 rotationMultiplier = S.momentumSettings.Amplitude.Aimed
5038 armTiltMultiplier = 0.2
5039 Cam.FieldOfView = S.aimSettings.FOV
5040 end
5041 Aiming = (not Aimed)
5042 if (not Aiming) and S.guiScope then
5043 spawn(function()
5044 scopeSteady.Visible = true
5045 Scope.BackgroundTransparency = 1
5046 scopeMain.Visible = true
5047
5048 if armTable then
5049 for _, Obj in pairs(armTable[1].Model:GetChildren()) do
5050 if Obj:IsA("BasePart") then
5051 Obj.LocalTransparencyModifier = 1
5052 end
5053 end
5054 for _, Obj in pairs(armTable[2].Model:GetChildren()) do
5055 if Obj:IsA("BasePart") then
5056 Obj.LocalTransparencyModifier = 1
5057 end
5058 end
5059 elseif armModel then
5060 for _, Obj in pairs(armModel:GetChildren()) do
5061 if Obj:IsA("BasePart") then
5062 Obj.LocalTransparencyModifier = 1
5063 end
5064 end
5065 end
5066 for _, Obj in pairs(playerFolder:GetChildren()) do
5067 if Obj:IsA("BasePart") then
5068 Obj.LocalTransparencyModifier = 1
5069 end
5070 end
5071 for _, Obj in pairs(Gun:GetChildren()) do
5072 if Obj:IsA("BasePart") then
5073 Obj.LocalTransparencyModifier = 1
5074 end
5075 end
5076 end)
5077 spawn(function()
5078 local camAng = 0
5079 local idleCam = function()
5080 return V3(
5081 RAD(SIN(camAng * S.scopeSettings.Frequency.Idling)) * stanceSway * camSway * S.scopeSettings.Amplitude.Idling,
5082 RAD(SIN(camAng * 5 / 2 * S.scopeSettings.Frequency.Idling)) * stanceSway * camSway * S.scopeSettings.Amplitude.Idling * 0.75,
5083 0
5084 )
5085 end
5086 local walkCam = function()
5087 return V3(
5088 RAD(SIN(camAng * S.scopeSettings.Frequency.Walking)) * camSway * stanceSway * S.scopeSettings.Amplitude.Walking,
5089 RAD(SIN(camAng * 5 / 2 * S.scopeSettings.Frequency.Walking)) * camSway * stanceSway * S.scopeSettings.Amplitude.Walking * 0.75,
5090 0
5091 )
5092 end
5093 while Aimed do
5094 local dt = RS.RenderStepped:wait()
5095 camOffsets.guiScope.Rot = (Sine(idleAlpha) * idleCam()) + (Sine(walkAlpha) * walkCam())
5096 camAng = camAng + RAD(105 * dt) * stanceSway * camSway
5097 end
5098 end)
5099 end
5100end
5101
5102function unAimGun(Exception)
5103 if (not S.canADS) then return end
5104
5105 mouseSensitivity = S.sensitivitySettings.Default
5106
5107 for _, Plugin in pairs(Plugins.UnAimed) do
5108 spawn(function()
5109 Plugin()
5110 end)
5111 end
5112
5113 if S.guiScope then
5114 spawn(function()
5115 if armTable then
5116 for _, Obj in pairs(armTable[1].Model:GetChildren()) do
5117 if Obj:IsA("BasePart") then
5118 Obj.LocalTransparencyModifier = 0
5119 end
5120 end
5121 for _, Obj in pairs(armTable[2].Model:GetChildren()) do
5122 if Obj:IsA("BasePart") then
5123 Obj.LocalTransparencyModifier = 0
5124 end
5125 end
5126 elseif armModel then
5127 for _, Obj in pairs(armModel:GetChildren()) do
5128 if Obj:IsA("BasePart") then
5129 Obj.LocalTransparencyModifier = 0
5130 end
5131 end
5132 end
5133 for _, Obj in pairs(playerFolder:GetChildren()) do
5134 if Obj:IsA("BasePart") then
5135 Obj.LocalTransparencyModifier = 0
5136 end
5137 end
5138 for _, Obj in pairs(Gun:GetChildren()) do
5139 if Obj:IsA("BasePart") then
5140 Obj.LocalTransparencyModifier = 0
5141 end
5142 end
5143 end)
5144 end
5145
5146 if (not Exception) then
5147 if (not Aimed) then return end
5148 if (Reloading and Exception) or Knifing then return end
5149 spreadZoom = "unAimed"
5150 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
5151 Aimed = false
5152 Aiming = true
5153 if S.aimSettings.Anim then
5154 local currentFOV = Cam.FieldOfView
5155 local currentTrans = (Scope.BackgroundTransparency == 1 and (S.guiScope and 0 or 1) or Scope.BackgroundTransparency)
5156 scopeMain.Visible = false
5157 scopeSteady.Visible = false
5158 tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, S.aimSettings.Speed)
5159 tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, S.aimSettings.Speed)
5160 tweenJoint(headWeld2, nil, CF(), Sine, S.aimSettings.Speed)
5161 tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, S.aimSettings.Speed)
5162 local t0 = tick()
5163 while true do
5164 RS.RenderStepped:wait()
5165 local Alpha = math.min((tick() - t0) / S.aimSettings.Speed, 1) * 90
5166 if Aimed then break end
5167 if (not Selected) then break end
5168 aimAlpha = 1 - Sine(Alpha)--1 - COS(RAD(X))
5169 aimHeadOffset = headOffset.X * aimAlpha
5170 jumpAnimMultiplier = numLerp(1, S.fallSettings.aimEffect, aimAlpha)
5171 translationDivisor = numLerp(7, 20, aimAlpha)
5172 rotationMultiplier = numLerp(S.momentumSettings.Amplitude.unAimed, S.momentumSettings.Amplitude.Aimed, aimAlpha)
5173 armTiltMultiplier = numLerp(1, 0.2, aimAlpha)
5174 Cam.FieldOfView = numLerp(80, currentFOV, aimAlpha)
5175 Scope.BackgroundTransparency = numLerp(1, currentTrans, aimAlpha)
5176 if Alpha == 90 then break end
5177 end
5178 else
5179 scopeMain.Visible = false
5180 scopeSteady.Visible = false
5181 LWeld.C0, LWeld.C1 = armC0[1], S.unAimedC1.leftArm
5182 RWeld.C0, RWeld.C1 = armC0[2], S.unAimedC1.rightArm
5183 headWeld2.C0 = CF()
5184 Grip.C1 = S.unAimedC1.Grip
5185 aimAlpha = 0
5186 aimHeadOffset = 0
5187 jumpAnimMultiplier = 1
5188 translationDivisor = 7
5189 rotationMultiplier = S.momentumSettings.Amplitude.unAimed
5190 armTiltMultiplier = 1
5191 Cam.FieldOfView = 80
5192 Scope.BackgroundTransparency = 1
5193 end
5194 Aiming = Aimed
5195 else
5196 spawn(function()
5197 Aimed = false
5198 Aiming = false
5199 spreadZoom = "unAimed"
5200 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
5201 local currentFOV = Cam.FieldOfView
5202 local currentTrans = (Scope.BackgroundTransparency == 1 and (S.guiScope and 0 or 1) or Scope.BackgroundTransparency)
5203 scopeMain.Visible = false
5204 scopeSteady.Visible = false
5205 tweenJoint(headWeld2, nil, CF(), Sine, S.aimSettings.Speed)
5206 if S.aimSettings.Anim then
5207 local t0 = tick()
5208 while true do
5209 RS.RenderStepped:wait()
5210 local Alpha = math.min((tick() - t0) / S.aimSettings.Speed, 1) * 90
5211 if Aimed then break end
5212 if (not Selected) then break end
5213 aimAlpha = 1 - Sine(Alpha)--1 - COS(RAD(90 - Alpha))
5214 aimHeadOffset = headOffset.X * aimAlpha
5215 jumpAnimMultiplier = numLerp(1, S.fallSettings.aimEffect, aimAlpha)
5216 translationDivisor = numLerp(7, 20, aimAlpha)
5217 rotationMultiplier = numLerp(S.momentumSettings.Amplitude.unAimed, S.momentumSettings.Amplitude.Aimed, aimAlpha)
5218 armTiltMultiplier = numLerp(1, 0.2, aimAlpha)
5219 Cam.FieldOfView = numLerp(80, currentFOV, aimAlpha)
5220 Scope.BackgroundTransparency = numLerp(1, currentTrans, aimAlpha)
5221 if Alpha == 90 then break end
5222 end
5223 else
5224 scopeMain.Visible = false
5225 scopeSteady.Visible = false
5226 aimAlpha = 0
5227 aimHeadOffset = 0
5228 jumpAnimMultiplier = 1
5229 translationDivisor = 7
5230 rotationMultiplier = S.momentumSettings.Amplitude.unAimed
5231 armTiltMultiplier = 1
5232 Cam.FieldOfView = 80
5233 Scope.BackgroundTransparency = 1
5234 end
5235 end)
5236 end
5237end
5238
5239--------------------[ TEXTURE CREATION FUNCTIONS ]------------------------------------
5240
5241function createBullet(Direction)
5242 local Origin = Gun.Main.CFrame.p
5243 local bulletCF = CF(Origin, Origin + Direction)
5244 local Bullet = Instance.new("Part")
5245 Bullet.BrickColor = S.bulletSettings.Color
5246 Bullet.Material = Enum.Material.Neon
5247 Bullet.Name = "Bullet"
5248 Bullet.CanCollide = false
5249 Bullet.FormFactor = "Custom"
5250 Bullet.Size = S.bulletSettings.Size
5251 Bullet.BottomSurface = "Smooth"
5252 Bullet.TopSurface = "Smooth"
5253 if math.min(S.bulletSettings.Size.X, S.bulletSettings.Size.Y, S.bulletSettings.Size.Z) < 0.2 then
5254 local Mesh = Instance.new("BlockMesh")
5255 Mesh.Scale = S.bulletSettings.Size / Vector3.new(
5256 math.max(S.bulletSettings.Size.X, 0.2),
5257 math.max(S.bulletSettings.Size.Y, 0.2),
5258 math.max(S.bulletSettings.Size.Z, 0.2)
5259 )
5260 Mesh.Parent = Bullet
5261 end
5262 local BF = Instance.new("BodyForce")
5263 BF.force = V3(0, Bullet:GetMass() * (196.2 - S.bulletSettings.Acceleration), 0)
5264 BF.Parent = Bullet
5265 Bullet.Parent = gunIgnore
5266 Bullet.CFrame = bulletCF + Direction * S.bulletSettings.Size.Z / 2
5267 Bullet.Velocity = Direction * S.bulletSettings.Velocity
5268 return Bullet
5269end
5270
5271--------------------[ HIT HANDLING FUNCTIONS ]----------------------------------------
5272
5273function getBaseDamage(Dist)
5274 local startDmg = S.damageSettings.Start.Damage
5275 local startDist = S.damageSettings.Start.Dist
5276 local endDmg = S.damageSettings.End.Damage
5277 local endDist = S.damageSettings.End.Dist
5278 return (
5279 (
5280 Dist < startDist * S.bulletSettings.Range
5281 ) and startDmg or
5282 (
5283 Dist >= startDist * S.bulletSettings.Range and
5284 Dist < endDist * S.bulletSettings.Range
5285 ) and numLerp(startDmg, endDmg, Map(Dist / S.bulletSettings.Range, startDist, endDist, 0, 1)) or
5286 (
5287 Dist >= endDist * S.bulletSettings.Range
5288 ) and endDmg
5289 )
5290end
5291
5292function Damage(H, P, N, D, Dist, customIgnore)
5293 local hVal = S.damageSettings.Multipliers.Head
5294 local cVal = S.damageSettings.Multipliers.Chest
5295 local lVal = S.damageSettings.Multipliers.Limbs
5296 local baseDamage = getBaseDamage(Dist)
5297 if Humanoid.Health ~= 0 then
5298 local hitHumanoid = nil
5299 if H.Parent:IsA("Hat") then
5300 table.insert(customIgnore, H)
5301 local newRay = Ray.new(P - D * 0.1, D * (S.bulletSettings.Range - Dist + 0.1))
5302 local newH, newP, newN = workspace:FindPartOnRayWithIgnoreList(newRay, customIgnore)
5303 if newH then
5304 hitHumanoid = Damage(newH, newP, newN, D, Dist + (newP - P).magnitude, customIgnore)
5305 end
5306 else
5307 hitHumanoid = findFirstClass(H.Parent, "Humanoid")
5308 if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
5309 local Tag = Instance.new("ObjectValue")
5310 Tag.Value = Player
5311 Tag.Name = "creator"
5312 Tag.Parent = hitHumanoid
5313 DS:AddItem(Tag, 0.3)
5314 local chosenDamage = 0
5315 if H.Name == "Head" then
5316 chosenDamage = baseDamage * RAND(hVal, hVal + 0.1, 0.01)
5317 elseif H.Name == "Torso" then
5318 chosenDamage = baseDamage * RAND(cVal, cVal + 0.1, 0.01)
5319 else
5320 chosenDamage = baseDamage * RAND(lVal, lVal + 0.1, 0.01)
5321 end
5322 hitHumanoid:TakeDamage(chosenDamage)
5323 markHit()
5324 end
5325 end
5326 return hitHumanoid
5327 end
5328end
5329
5330function isWallIgnored(Wall)
5331 return (
5332 Wall.Transparency >= S.penetrationSettings.transparencyThreshold or
5333 (S.penetrationSettings.ignoreNonCanCollide and (not Wall.CanCollide)) or
5334 isIgnored(Wall, S.penetrationSettings.ignoreCustom)
5335 )
5336end
5337
5338function penetrateWall(Wall, hitPos, Direction, Normal, Ignore, totalPDist, totalBDist, lastDamagedHumanoid)
5339 local wallIgnore = isWallIgnored(Wall)
5340 local hitHumanoid = (Wall.Parent:IsA("Hat") and findFirstClass(Wall.Parent.Parent, "Humanoid") or findFirstClass(Wall.Parent, "Humanoid"))
5341 local damagedHumanoid = nil
5342 if hitHumanoid and hitHumanoid ~= lastDamagedHumanoid then
5343 lastDamagedHumanoid = hitHumanoid
5344 damagedHumanoid = Damage(Wall, hitPos, Normal, Direction, totalBDist, {Char, ignoreModel})
5345 else
5346 lastDamagedHumanoid = nil
5347 end
5348 local ignoreObject = hitHumanoid and (Wall.Parent:IsA("Hat") and Wall.Parent.Parent or Wall.Parent) or Wall
5349 table.insert(Ignore, ignoreObject)
5350 local rayLength = S.bulletSettings.Range - totalBDist
5351 local testRay = Ray.new(hitPos, Direction * (S.bulletSettings.Range - totalBDist))
5352 local H1, P1, N1 = workspace:FindPartOnRayWithIgnoreList(testRay, Ignore)
5353 local newIgnore = removeElement(Ignore, ignoreObject)
5354 local wallRay = Ray.new(P1 + Direction * 0.1, -Direction * (rayLength + 1))
5355 local H2, P2, N2 = workspace:FindPartOnRayWithIgnoreList(wallRay, Ignore)
5356 local newPDist = totalPDist + (wallIgnore and 0 or (getNearestPoint(P1, P2, hitPos) - hitPos).magnitude)
5357 local newBDist = totalBDist + (P1 - hitPos).magnitude
5358 local outOfRange = Round(newPDist, 0.001) > S.penetrationSettings.Dist or Round(newBDist, 0.001) > S.bulletSettings.Range
5359 if (not wallIgnore) then
5360 createBulletImpact:FireServer(Wall, hitPos, Normal, Direction, hitHumanoid, gunIgnore, S)
5361 if (not hitHumanoid) then
5362 createShockwave:FireServer(hitPos, S.shockwaveSettings.Radius, gunIgnore, S)
5363 end
5364 end
5365 if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) and hitHumanoid == damagedHumanoid then
5366 createBlood:FireServer(Wall, P2, Direction, gunIgnore, S)
5367 end
5368 if outOfRange or (not H1) then
5369 if (not outOfRange) and (not wallIgnore) then
5370 createBulletImpact:FireServer(Wall, P2, N2, Direction, hitHumanoid, gunIgnore, S)
5371 if (not hitHumanoid) then
5372 createShockwave:FireServer(P2, S.shockwaveSettings.Radius, gunIgnore, S)
5373 end
5374 end
5375 return Wall, hitPos
5376 else
5377 if Wall == H2 and (not wallIgnore) then
5378 createBulletImpact:FireServer(Wall, P2, N2, Direction, hitHumanoid, gunIgnore, S)
5379 if (not hitHumanoid) then
5380 createShockwave:FireServer(P2, S.shockwaveSettings.Radius, gunIgnore, S)
5381 end
5382 end
5383 return penetrateWall(H1, P1, Direction, N1, Ignore, newPDist, newBDist, lastDamagedHumanoid)
5384 end
5385end
5386
5387function PenetrateWall(HitPos, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist)
5388 local HitDist = (HitPos - OriginPos).magnitude
5389 local Wall, WallHitPos = nil, nil
5390 local Hum, HumHitPos = nil, nil
5391 local CustomIgnore = {unpack(Ignore)}
5392 for i = 1, 10 do
5393 local WallRay = Ray.new(HitPos - (Direction * 0.1), Direction * S.Penetration)
5394 local H, P = game.Workspace:FindPartOnRayWithIgnoreList(WallRay, CustomIgnore)
5395 if H then
5396 local HitHumanoid = nil
5397 if H.Parent.ClassName == "Hat" then
5398 HitHumanoid = findFirstClass(H.Parent.Parent, "Humanoid")
5399 else
5400 HitHumanoid = findFirstClass(H.Parent, "Humanoid")
5401 end
5402 if HitHumanoid and i ~= 1 then
5403 Hum, HumHitPos = H, P
5404 break
5405 else
5406 Wall, WallHitPos = H, P
5407 table.insert(CustomIgnore, H)
5408 end
5409 else
5410 break
5411 end
5412 end
5413 if Wall then
5414 if S.InstantHit then
5415 if Hum then
5416 Damage(Hum.Parent:FindFirstChild("Head"), HumHitPos)
5417 return HumHitPos
5418 else
5419 local HitObj2, HitPos2 = nil, nil
5420 if HitHumanoid then
5421 HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist, {Wall, HitHumanoid.Parent, unpack(Ignore)})
5422 else
5423 HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist, {Wall, unpack(Ignore)})
5424 end
5425 Damage(HitObj2, HitPos2)
5426
5427 local NewPDist = CurrentPDist + (WallHitPos - HitPos).magnitude
5428 local NewHitPos2 = HitPos2
5429 if NewPDist < S.Penetration and HitObj2 then
5430 NewHitPos2 = PenetrateWall(HitPos2, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist + NewPDist)
5431 end
5432 return NewHitPos2
5433 end
5434 else
5435 local LastPos = WallHitPos
5436 local TotalDistTraveled = 0
5437 spawn(function()
5438 if Hum then
5439 Damage(Hum.Parent:FindFirstChild("Head"), HumHitPos)
5440 return HumHitPos
5441 else
5442 while true do
5443 RS.RenderStepped:wait()
5444 if TotalDistTraveled >= S.BulletRange - HitDist then
5445 Bullet:Destroy()
5446 break
5447 end
5448 local DistTraveled = (Bullet.Position - LastPos).magnitude
5449 local NewDirection = (Bullet.Position - LastPos).unit
5450 local TempHitObj, TempHitPos = nil, nil
5451 if HitHumanoid then
5452 TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled, {Wall, HitHumanoid.Parent, unpack(Ignore)})
5453 else
5454 TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled, {Wall, unpack(Ignore)})
5455 end
5456 if TempHitObj then
5457 Damage(TempHitObj, TempHitPos)
5458
5459 local NewPDist = CurrentPDist + (WallHitPos - HitPos).magnitude
5460 local NewTempPos = TempHitPos
5461 if NewPDist < S.Penetration and TempHitObj then
5462 NewTempPos = PenetrateWall(TempHitPos, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist + NewPDist)
5463 else
5464 Bullet:Destroy()
5465 end
5466 return NewTempPos
5467 else
5468 LastPos = Bullet.Position
5469 TotalDistTraveled = TotalDistTraveled + DistTraveled
5470 end
5471 end
5472 end
5473 end)
5474 end
5475 else
5476 if Bullet then Bullet:Destroy() end
5477 return HitPos
5478 end
5479end
5480
5481function isEnemy(Human)
5482 local Plyr = game.Players:GetPlayerFromCharacter(Human.Parent)
5483 if (not Plyr) then return S.CanDamageNPCs end
5484 return S.AllowFriendlyFire or (Plyr.TeamColor ~= Player.TeamColor or Plyr.Neutral)
5485end
5486
5487--------------------[ RELOAD FUNCTIONS ]----------------------------------------------
5488
5489function animateReload()
5490 tweenJoint(LWeld2, CF(), CF(), Sine, 0.15)
5491 tweenJoint(RWeld2, CF(), CF(), Sine, 0.15)
5492 local magParts = {}
5493 local magTable = {}
5494
5495 for _, Obj in pairs(Gun:GetChildren()) do
5496 if string.sub(Obj.Name, 1, 3) == "Mag" and Obj:IsA("BasePart") then
5497 INSERT(magParts, Obj)
5498 end
5499 end
5500
5501 local animVars = {
5502 --FUNCTIONS--
5503 tweenJoint = tweenJoint;
5504
5505 makeMagInvisible = function()
5506 for _, v in pairs(magParts) do
5507 v.Transparency = 1
5508 end
5509 magVisible = false
5510 end;
5511
5512 makeMagVisible = function()
5513 for _, v in pairs(magParts) do
5514 v.Transparency = v:WaitForChild("magTrans").Value
5515 end
5516 magVisible = true
5517 end;
5518
5519 isMagVisible = function()
5520 return magVisible
5521 end;
5522
5523 isMagEmpty = function()
5524 return ammoInClip == 0
5525 end;
5526
5527 setNewMag = function()
5528 newMag = true
5529 end;
5530
5531 isNewMag = function()
5532 return newMag
5533 end;
5534
5535 createMag = function(Key)
5536 local magModel = Instance.new("Model")
5537 local magClones = {}
5538 for i, v in pairs(magParts) do
5539 local vClone = v:Clone()
5540 vClone.Transparency = v:WaitForChild("magTrans").Value
5541 vClone.CanCollide = false
5542 vClone.Parent = magModel
5543 INSERT(magClones, {Original = v, magClone = vClone})
5544 if i ~= 1 then
5545 local W = Instance.new("Weld")
5546 W.Part0 = magClones[1].magClone
5547 W.Part1 = vClone
5548 W.C0 = magClones[1].magClone.CFrame:toObjectSpace(vClone.CFrame)
5549 W.Parent = magClones[1].magClone
5550 end
5551 end
5552 magTable[Key] = {magModel, magClones}
5553 return magModel, magClones
5554 end;
5555
5556 getMag = function(Key)
5557 if magTable[Key] then
5558 return magTable[Key][1], magTable[Key][2]
5559 else
5560 return nil, nil
5561 end
5562 end;
5563
5564 attachGripToHead = function()
5565 local handleCF = RArm.CFrame * Grip.C0
5566 Grip.C0 = Head.CFrame:toObjectSpace(handleCF)
5567 Grip.Part0 = Head
5568 end;
5569
5570 attachGripToArm = function()
5571 local handleCF = Head.CFrame * Grip.C0
5572 Grip.C0 = RArm.CFrame:toObjectSpace(handleCF)
5573 Grip.Part0 = RArm
5574 end;
5575
5576 Sine = Sine;
5577
5578 Linear = Linear;
5579
5580 --VARIABLES--
5581 Handle = Handle;
5582 LArm = LArm;
5583 RArm = RArm;
5584 LWeld = LWeld;
5585 RWeld = RWeld;
5586 LC0 = armC0[1];
5587 RC0 = armC0[2];
5588 Grip = Grip;
5589 gunIgnore = gunIgnore;
5590 Cam = Cam;
5591 CF = CF;
5592 CFANG = CFANG;
5593 V3 = V3;
5594 RAD = RAD;
5595 reloadTimeLoaded = S.reloadSettings.Times.Loaded;
5596 reloadTimeEmpty = S.reloadSettings.Times.Empty
5597 }
5598
5599 local sequenceTable = Anims.Reload(animVars)
5600 --local T = tick()
5601 for _, reloadFunction in pairs(sequenceTable) do
5602 if breakReload then
5603 break
5604 end
5605 reloadFunction()
5606
5607 if (not magVisible) then
5608 Ammo.Value = 0
5609 end
5610 updateClipAmmo()
5611 end
5612 --print(tick() - T) --I divide the reloadTime by this number to get the animation speed
5613
5614 if (not isCrawling) then
5615 if Running and (not S.canFireWhileRunning) then
5616 tweenJoint(LWeld, armC0[1], S.runningC1.leftArm, Sine, 0.4)
5617 tweenJoint(RWeld, armC0[2], S.runningC1.rightArm, Sine, 0.4)
5618 tweenJoint(Grip, nil, S.runningC1.Grip, Sine, 0.4)
5619 else
5620 tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, 0.4)
5621 tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, 0.4)
5622 tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.4)
5623 end
5624 end
5625
5626 for _, v in pairs(magTable) do --In case the reload animations was stopped mid way and there were still fake mags that weren't deleted
5627 v[1]:Destroy()
5628 end
5629end
5630
5631function Reload()
5632 if Ammo.Value < (ClipSize.Value + 1) and (not Reloading) and StoredAmmo.Value > 0 then
5633 Firing = false
5634 ammoInClip = (ammoInClip == 0 and Ammo.Value or ammoInClip)
5635 Reloading = true
5636 lowerSpread()
5637 if Aimed then unAimGun(S.reloadSettings.Anim) end
5638 crossHair.Reload.Visible = true
5639 if Handle:FindFirstChild("ReloadSound") then Handle.ReloadSound:Play() end
5640 if S.reloadSettings.Anim then
5641 wait()
5642 animateReload()
5643 else
5644 local startReload = tick()
5645 local initialReloadTime = Ammo.Value == 0 and S.reloadSettings.Times.Empty or S.reloadSettings.Times.Loaded
5646 while true do
5647 if breakReload then break end
5648 if (tick() - startReload) >= initialReloadTime then break end
5649 RS.RenderStepped:wait()
5650 end
5651 end
5652 if (not breakReload) then
5653 newMag = false
5654 if StoredAmmo.Value >= ClipSize.Value then
5655 if ammoInClip > 0 then
5656 StoredAmmo.Value = StoredAmmo.Value - ((ClipSize.Value + 1) - ammoInClip)
5657 Ammo.Value = ClipSize.Value + 1
5658 else
5659 StoredAmmo.Value = StoredAmmo.Value - ClipSize.Value
5660 Ammo.Value = ClipSize.Value
5661 end
5662 elseif StoredAmmo.Value < ClipSize.Value and StoredAmmo.Value > 0 then
5663 Ammo.Value = StoredAmmo.Value
5664 StoredAmmo.Value = 0
5665 end
5666 end
5667 Reloading = false
5668 if Selected then
5669 ammoInClip = (breakReload and ammoInClip or 0)
5670 crossHair.Reload.Visible = false
5671 end
5672 breakReload = false
5673 end
5674
5675 updateClipAmmo()
5676 updateStoredAmmo()
5677end
5678
5679--------------------[ EXTERNAL DATA LOCATING FUNCTIONS ]-----------------------------
5680
5681function removeElement(Table, Element) --removes the first instance of Element from Table
5682 for i, v in pairs(Table) do
5683 if v == Element then
5684 table.remove(Table, i)
5685 break
5686 end
5687 end
5688 return Table
5689end
5690
5691function findFirstClass(Object, Class)
5692 local foundObject = nil
5693 for _, Obj in pairs(Object:GetChildren()) do
5694 if Obj.ClassName == Class then
5695 foundObject = Obj
5696 break
5697 end
5698 end
5699 return foundObject
5700end
5701
5702function isIgnored(Obj, Table)
5703 for _,v in pairs(Table) do
5704 if Obj == v or Obj:IsDescendantOf(v) then
5705 return true
5706 end
5707 end
5708 return false
5709end
5710
5711function GetHitSurfaceCFrame(HitPos,Obj)
5712 local SurfaceCF = {
5713 {"Back",Obj.CFrame * CF(0,0,Obj.Size.z)};
5714 {"Bottom",Obj.CFrame * CF(0,-Obj.Size.y,0)};
5715 {"Front",Obj.CFrame * CF(0,0,-Obj.Size.z)};
5716 {"Left",Obj.CFrame * CF(-Obj.Size.x,0,0)};
5717 {"Right",Obj.CFrame * CF(Obj.Size.x,0,0)};
5718 {"Top",Obj.CFrame * CF(0,Obj.Size.y,0)}
5719 }
5720 local ClosestDist = HUGE
5721 local ClosestSurface = nil
5722 for _,v in pairs(SurfaceCF) do
5723 local SurfaceDist = (HitPos - v[2].p).magnitude
5724 if SurfaceDist < ClosestDist then
5725 ClosestDist = SurfaceDist
5726 ClosestSurface = v
5727 end
5728 end
5729 return ClosestSurface[2]
5730end
5731
5732function AdvRayCast(Origin, Direction, Dist, CustomIgnore)
5733 local NewIgnore = (CustomIgnore and CustomIgnore or Ignore)
5734 local NewRay = Ray.new(Origin, Direction * (Dist > 999 and 999 or Dist))
5735 local HitObj, HitPos = game.Workspace:FindPartOnRayWithIgnoreList(NewRay, NewIgnore)
5736 local LastPos = HitPos
5737 local FinalHitObj, FinalHitPos = nil, nil
5738 local RepTimes = math.floor(Dist / 999)
5739 if (not HitObj) and (Dist > 999) then
5740 for i = 0, RepTimes do
5741 local NewDist = (i == RepTimes and (Dist - (LastPos - Origin).magnitude) or 999)
5742 local Ray2 = Ray.new(LastPos, Direction * NewDist)
5743 local HitObj2, HitPos2 = game.Workspace:FindPartOnRayWithIgnoreList(Ray2, NewIgnore)
5744 if i ~= RepTimes then
5745 if HitObj2 then
5746 FinalHitObj, FinalHitPos = HitObj2, HitPos2
5747 break
5748 end
5749 elseif i == RepTimes then
5750 FinalHitObj, FinalHitPos = HitObj2, HitPos2
5751 end
5752 LastPos = HitPos2
5753 end
5754 return FinalHitObj, FinalHitPos
5755 elseif HitObj or (Dist <= 999) then
5756 return HitObj, HitPos
5757 end
5758end
5759
5760--------------------[ JUMPING ANIMATION ]---------------------------------------------
5761
5762function onFall(initialVelocity)
5763 spawn(function()
5764 local velocityAlpha = math.max(math.min(initialVelocity / Humanoid.JumpPower, 1), 0)
5765 local startJumpPos = jumpAnim.Pos
5766 local startJumpRot = jumpAnim.Rot
5767 local endJumpPos = 0.04 * S.fallSettings.fallMultiplier * velocityAlpha
5768 local endJumpRot = RAD(4) * S.fallSettings.fallMultiplier * velocityAlpha
5769 local t0 = tick()
5770 while true do
5771 RS.Heartbeat:wait()
5772 local Alpha = math.min((tick() - t0) / 0.15, 1) * 90
5773 if onGround then break end
5774 jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Sine(Alpha))
5775 jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Sine(Alpha))
5776 if Alpha == 90 then break end
5777 end
5778 startJumpPos = endJumpPos
5779 startJumpRot = endJumpRot
5780 endJumpPos = -0.08 * S.fallSettings.fallMultiplier
5781 endJumpRot = -RAD(8) * S.fallSettings.fallMultiplier
5782 local X = 1
5783 while true do
5784 local dt = RS.Heartbeat:wait()
5785 X = X + (dt * 60) / X
5786 local Alpha = (X - 1) / 15
5787 if onGround then break end
5788 jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Alpha)
5789 jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Alpha)
5790 end
5791 end)
5792end
5793
5794function onLand(fallDist)
5795 spawn(function()
5796 local animAlpha = math.min(fallDist, S.fallSettings.maxDist) * (2 / 3)
5797 local startJumpPos = jumpAnim.Pos
5798 local startJumpRot = jumpAnim.Rot
5799 local endJumpPos = animAlpha / 100 * S.fallSettings.landMultiplier * (runReady and 1 or 2)
5800 local endJumpRot = RAD(animAlpha) * S.fallSettings.landMultiplier * (runReady and 1 or 2)
5801 local t0 = tick()
5802 while true do
5803 RS.Heartbeat:wait()
5804 local Alpha = math.min((tick() - t0) / 0.2, 1)
5805 if (not onGround) then break end
5806 jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Alpha)
5807 jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Alpha)
5808 if Alpha == 1 then break end
5809 end
5810 t0 = tick()
5811 while true do
5812 RS.Heartbeat:wait()
5813 local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
5814 if (not onGround) then break end
5815 jumpAnim.Pos = numLerp(endJumpPos, 0, Sine(Alpha))
5816 jumpAnim.Rot = numLerp(endJumpRot, 0, Sine(Alpha))
5817 if Alpha == 90 then break end
5818 end
5819 end)
5820end
5821
5822function onHumanoidStateChanged(oldState, newState)
5823 if newState == Enum.HumanoidStateType.Freefall then
5824 onGround = false
5825 if S.fallAnimation then
5826 onFall(HRP.Velocity.Y)
5827 while HRP.Velocity.Y > 0 do RS.RenderStepped:wait() end
5828 startFallHeight = HRP.Position.Y
5829 end
5830 elseif oldState == Enum.HumanoidStateType.Freefall then
5831 onGround = true
5832 if S.fallAnimation then
5833 local fallDist = startFallHeight - HRP.Position.Y
5834 onLand(fallDist)
5835 end
5836 end
5837end
5838--------------------[ CAMERA STEADYING FUNCTIONS ]------------------------------------
5839
5840function steadyCamera()
5841 scopeSteady.Text = "Steadying..."
5842 scopeSteady.TextColor3 = Color3.new(1, 1, 0)
5843 camSteady = true
5844 local originalSway = camSway
5845 local Increment = 1.5 / 0.6
5846 local X = 0
5847 while true do
5848 RS.RenderStepped:wait()
5849 local newX = X + Increment
5850 X = (newX > 90 and 90 or newX)
5851 if (not steadyKeyPressed) then break end
5852 camSway = numLerp(originalSway, 0, Sine(X))
5853 if X == 90 then break end
5854 end
5855 while steadyKeyPressed and Aimed do
5856 if currentSteadyTime > 0 then
5857 local NewSteadyTime = currentSteadyTime - 1
5858 currentSteadyTime = (NewSteadyTime < 0 and 0 or NewSteadyTime)
5859 camSway = 0
5860 elseif currentSteadyTime == 0 then
5861 break
5862 end
5863 RS.RenderStepped:wait()
5864 end
5865 camSteady = false
5866 spawn(function()
5867 local Increment = 1.5 / 0.25
5868 local X = 0
5869 while true do
5870 RS.RenderStepped:wait()
5871 local newX = X + Increment
5872 X = (newX > 90 and 90 or newX)
5873 if camSteady then break end
5874 camSway = numLerp(0, S.scopeSettings.camSwayOnBreath, 1 - COS(RAD(X)))
5875 if X == 90 then break end
5876 end
5877 Increment = 1.5 / S.scopeSettings.breathTime
5878 X = 0
5879 while true do
5880 RS.RenderStepped:wait()
5881 local newX = X + Increment
5882 X = (newX > 90 and 90 or newX)
5883 if camSteady then break end
5884 camSway = numLerp(S.scopeSettings.camSwayOnBreath, 1, Sine(X))
5885 if X == 90 then break end
5886 end
5887 --[[for X = 0, 90, 1.5 / 0.2 do
5888 local Alpha = 1 - COS(RAD(X))--math.log10(X) / math.log10(90)
5889 camSway = numLerp(0, 3, Alpha)
5890 RS.RenderStepped:wait()
5891 end]]
5892 --[[for X = 0, 90, 1.5 / S.scopeSettings.steadyTime do
5893 if camSteady then break end
5894 local Alpha = SIN(RAD(X))
5895 camSway = numLerp(3, 1, Alpha)
5896 RS.RenderStepped:wait()
5897 end]]
5898 end)
5899 retakeBreath()
5900end
5901
5902function retakeBreath()
5903 scopeSteady.Text = "Re-taking Breath"
5904 scopeSteady.TextColor3 = Color3.new(1, 0, 0)
5905 takingBreath = true
5906 local Increment = S.scopeSettings.steadyTime / S.scopeSettings.breathTime
5907 while takingBreath do
5908 if currentSteadyTime < maxSteadyTime then
5909 local newSteadyTime = currentSteadyTime + Increment
5910 currentSteadyTime = (newSteadyTime > maxSteadyTime and maxSteadyTime or newSteadyTime)
5911 elseif currentSteadyTime >= maxSteadyTime then
5912 break
5913 end
5914 RS.RenderStepped:wait()
5915 end
5916 if takingBreath then
5917 scopeSteady.Text = "Hold "..convertKey(S.Keys.scopeSteady).." to Steady"
5918 scopeSteady.TextColor3 = Color3.new(1, 1, 0)
5919 takingBreath = false
5920 end
5921end
5922
5923--------------------[ SPRINTING FUNCTIONS ]-------------------------------------------
5924
5925function canRun(midRun)
5926 return ((Forward and (not Backward)) and
5927 Walking and (Stamina > 0) and Running and
5928 Selected and (midRun and true or onGround) and
5929 runReady and (S.canFireWhileRunning and true or (not Firing))
5930 )
5931end
5932
5933function monitorStamina()
5934 Running = true
5935 if (not canRun(false)) then
5936 Running = false
5937 return
5938 end
5939 if Aimed then unAimGun(true) end
5940 if Stance == 1 or Stance == 2 then Stand() end
5941 if (not (Reloading and S.reloadSettings.Anim)) then
5942 if S.canFireWhileRunning then
5943 tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, 0.4)
5944 tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, 0.4)
5945 tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.4)
5946 else
5947 tweenJoint(LWeld, armC0[1], S.runningC1.leftArm, Sine, 0.4)
5948 tweenJoint(RWeld, armC0[2], S.runningC1.rightArm, Sine, 0.4)
5949 tweenJoint(Grip, nil, S.runningC1.Grip, Sine, 0.4)
5950 end
5951 end
5952 crossOffset = 50
5953 while runKeyPressed do
5954 if canRun(true) then
5955 if onGround then
5956 local newStamina = Stamina - 1
5957 Stamina = (newStamina < 0 and 0 or newStamina)
5958 end
5959 else
5960 break
5961 end
5962 RS.RenderStepped:wait()
5963 end
5964 Running = false
5965 if (not Aimed) and (not (Reloading and S.reloadSettings.Anim)) and (not S.canFireWhileRunning) then
5966 crossOffset = 0
5967 tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, 0.4)
5968 tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, 0.4)
5969 tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.4)
5970 end
5971
5972 rechargeStamina()
5973end
5974
5975function rechargeStamina()
5976 chargingStamina = true
5977 while ((not runKeyPressed) or (Stamina < maxStamina)) and (not Running) do
5978 if Stamina < maxStamina then
5979 local newStamina = Stamina + (S.sprintTime / S.staminaCoolTime)
5980 Stamina = (newStamina > maxStamina and maxStamina or newStamina)
5981 elseif Stamina >= maxStamina then
5982 break
5983 end
5984 RS.RenderStepped:wait()
5985 end
5986 chargingStamina = false
5987end
5988
5989--------------------[ STANCE FUNCTIONS ]----------------------------------------------
5990
5991function Stand(onDeselected)
5992 local LHip = Torso["Left Hip"]
5993 local RHip = Torso["Right Hip"]
5994 LLegWeld.Part1 = nil
5995 LHip.Part1 = LLeg
5996 RLegWeld.Part1 = nil
5997 RHip.Part1 = RLeg
5998 Stance = 0
5999 spreadStance = "Stand"
6000 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
6001 if S.stanceSettings.Anim and (not onDeselected) then
6002 spawn(function()
6003 local prevStanceSway = stanceSway
6004 local X = 0
6005 local Increment = 1.5 / S.stanceSettings.Speed
6006 while true do
6007 RS.RenderStepped:wait()
6008 local newX = X + Increment
6009 X = (newX > 90 and 90 or newX)
6010 if Stance ~= 0 then break end
6011 stanceSway = numLerp(prevStanceSway, 1, Sine(X))
6012 if X == 90 then break end
6013 end
6014 end)
6015 tweenJoint(ABWeld, CF(), nil, Sine, S.stanceSettings.Speed)
6016 tweenJoint(LLegWeld, legC0.Stand[1], nil, Sine, S.stanceSettings.Speed)
6017 tweenJoint(RLegWeld, legC0.Stand[2], nil, Sine, S.stanceSettings.Speed)
6018 tweenJoint(LHip, CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0), Sine, S.stanceSettings.Speed)
6019 tweenJoint(RHip, CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0), Sine, S.stanceSettings.Speed)
6020 tweenJoint(Root, CFANG(RAD(-90), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
6021 tweenJoint(headWeld, CF(0, 1.5, 0), nil, Sine, S.stanceSettings.Speed)
6022 elseif onDeselected or (not S.stanceSettings.Anim) then
6023 ABWeld.C0 = CF()
6024 LLegWeld.C0 = legC0.Stand[1]
6025 RLegWeld.C0 = legC0.Stand[2]
6026 LHip.C0, LHip.C1 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0)
6027 RHip.C0, RHip.C1 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0)
6028 Root.C0 = CFANG(RAD(-90), 0, RAD(180))
6029 headWeld.C0 = CF(0, 1.5, 0)
6030 end
6031end
6032
6033function Crouch()
6034 local LHip = Torso["Left Hip"]
6035 local RHip = Torso["Right Hip"]
6036 LHip.Part1 = nil
6037 LLegWeld.Part1 = LLeg
6038 RHip.Part1 = nil
6039 RLegWeld.Part1 = RLeg
6040 Stance = 1
6041 spreadStance = "Crouch"
6042 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
6043 if S.stanceSettings.Anim then
6044 spawn(function()
6045 local prevStanceSway = stanceSway
6046 local X = 0
6047 local Increment = 1.5 / S.stanceSettings.Speed
6048 while true do
6049 RS.RenderStepped:wait()
6050 local newX = X + Increment
6051 X = (newX > 90 and 90 or newX)
6052 if Stance ~= 1 then break end
6053 stanceSway = numLerp(prevStanceSway, 0.75, Sine(X))
6054 if X == 90 then break end
6055 end
6056 end)
6057 tweenJoint(ABWeld, CF(0, 0, -0.05), nil, Sine, S.stanceSettings.Speed)
6058 tweenJoint(LLegWeld, legC0.Crouch[1], nil, Sine, S.stanceSettings.Speed)
6059 tweenJoint(RLegWeld, legC0.Crouch[2], nil, Sine, S.stanceSettings.Speed)
6060 tweenJoint(LHip, CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90)), Sine, S.stanceSettings.Speed)
6061 tweenJoint(RHip, CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0), Sine, S.stanceSettings.Speed)
6062 tweenJoint(Root, CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
6063 tweenJoint(headWeld, CF(0, 1.5, 0), nil, Sine, S.stanceSettings.Speed)
6064 else
6065 ABWeld.C0 = CF(0, 0, -1 / 16)
6066 LLegWeld.C0 = legC0.Crouch[1]
6067 RLegWeld.C0 = legC0.Crouch[2]
6068 LHip.C0, LHip.C1 = CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90))
6069 RHip.C0, RHip.C1 = CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0)
6070 Root.C0 = CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180))
6071 headWeld.C0 = CF(0, 1.5, 0)
6072 end
6073end
6074
6075function Prone()
6076 local LHip = Torso["Left Hip"]
6077 local RHip = Torso["Right Hip"]
6078 LHip.Part1 = nil
6079 LLegWeld.Part1 = LLeg
6080 RHip.Part1 = nil
6081 RLegWeld.Part1 = RLeg
6082 Stance = 2
6083 spreadStance = "Prone"
6084 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
6085 if S.stanceSettings.Anim then
6086 spawn(function()
6087 local prevStanceSway = stanceSway
6088 local X = 0
6089 local Increment = 1.5 / S.stanceSettings.Speed
6090 while true do
6091 RS.RenderStepped:wait()
6092 local newX = X + Increment
6093 X = (newX > 90 and 90 or newX)
6094 if Stance ~= 2 then break end
6095 stanceSway = numLerp(prevStanceSway, 0.5, Sine(X))
6096 if X == 90 then break end
6097 end
6098 end)
6099 tweenJoint(ABWeld, CF(0, 0, -0.1), nil, Sine, S.stanceSettings.Speed)
6100 tweenJoint(LLegWeld, legC0.Prone[1], nil, Sine, S.stanceSettings.Speed)
6101 tweenJoint(RLegWeld, legC0.Prone[2], nil, Sine, S.stanceSettings.Speed)
6102 tweenJoint(Root, CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
6103 tweenJoint(headWeld, CF(0, 1, 1) * CFANG(RAD(90), 0, 0), nil, Sine, S.stanceSettings.Speed)
6104 else
6105 ABWeld.C0 = CF(0, 0, -1 / 8)
6106 LLegWeld.C0 = legC0.Prone[1]
6107 RLegWeld.C0 = legC0.Prone[2]
6108 Root.C0 = CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180))
6109 headWeld.C0 = CF(0, 1, 1) * CFANG(RAD(90), 0, 0)
6110 end
6111end
6112
6113function Dive()
6114 onGround = false
6115 local diveDirection = (HRP.CFrame * CFANG(S.diveSettings.Angle, 0, 0)).lookVector * S.walkSpeeds.Sprinting * S.diveSettings.Force
6116 local BF = Instance.new("BodyForce")
6117 BF.force = diveDirection + Vector3.new(0, playerMass * 196.2, 0)
6118 BF.Parent = HRP
6119 --[[spawn(function()
6120 HRP.Velocity = HRP.CFrame.lookVector * 60 + V3(0, 40, 0)
6121 wait(0.1)
6122 HRP.Velocity = HRP.CFrame.lookVector * 70 + V3(0, 30, 0)
6123 wait(0.4)
6124 HRP.Velocity = HRP.CFrame.lookVector * 30 + V3(0, -10, 0)
6125 end)]]
6126 delay(0.05, function()
6127 spawn(function()
6128 while true do
6129 local newRay = Ray.new(HRP.Position, V3(0, -3.1, 0))
6130 local H, _ = workspace:FindPartOnRayWithIgnoreList(newRay, Ignore)
6131 if H then
6132 onGround = true
6133 break
6134 end
6135 wait()
6136 end
6137 end)
6138 Prone()
6139 wait(0.1)
6140 BF:Destroy()
6141 end)
6142end
6143
6144--------------------[ MOUSE FUNCTIONS ]-----------------------------------------------
6145
6146function onMB1Down()
6147 MB1Down = true
6148 firstShot = true
6149 if fireFunction then
6150 fireFunction()
6151 end
6152end
6153
6154function onMB1Up()
6155 MB1Down = false
6156 lowerSpread()
6157end
6158
6159function onMB2Down()
6160 if S.aimSettings.holdToADS then
6161 if (not AimingIn) and (not Aimed) then
6162 AimingIn = true
6163 aimGun()
6164 AimingIn = false
6165 end
6166 else
6167 if Aimed then
6168 unAimGun()
6169 else
6170 aimGun()
6171 end
6172 end
6173end
6174
6175function onMB2Up()
6176 if S.aimSettings.holdToADS then
6177 if (not AimingOut) and Aimed then
6178 AimingOut = true
6179 unAimGun()
6180 AimingOut = false
6181 end
6182 end
6183end
6184
6185function onScrollUp()
6186 local newAimSensitivity = aimSensitivity + S.sensitivitySettings.Increment
6187 aimSensitivity = (
6188 newAimSensitivity < S.sensitivitySettings.Min and S.sensitivitySettings.Min or
6189 newAimSensitivity > S.sensitivitySettings.Max and S.sensitivitySettings.Max or
6190 newAimSensitivity
6191 )
6192 mouseSensitivity = (Aimed and aimSensitivity or mouseSensitivity)
6193
6194 Sens.Text = "S: "..aimSensitivity
6195 if mainGUI:IsDescendantOf(game) then
6196 Sens.Visible = true
6197 local t0 = tick()
6198 lastSensUpdate = t0
6199
6200 wait(0.3)
6201
6202 if lastSensUpdate <= t0 then
6203 Sens.Visible = false
6204 end
6205 end
6206end
6207
6208function onScrollDown()
6209 local newAimSensitivity = aimSensitivity - S.sensitivitySettings.Increment
6210 aimSensitivity = (
6211 newAimSensitivity < S.sensitivitySettings.Min and S.sensitivitySettings.Min or
6212 newAimSensitivity > S.sensitivitySettings.Max and S.sensitivitySettings.Max or
6213 newAimSensitivity
6214 )
6215 mouseSensitivity = (Aimed and aimSensitivity or mouseSensitivity)
6216
6217 Sens.Text = "S: "..aimSensitivity
6218 if mainGUI:IsDescendantOf(game) then
6219 Sens.Visible = true
6220 local t0 = tick()
6221 lastSensUpdate = t0
6222
6223 wait(0.3)
6224
6225 if lastSensUpdate <= t0 then
6226 Sens.Visible = false
6227 end
6228 end
6229end
6230
6231--------------------[ KEYBOARD FUNCTIONS ]--------------------------------------------
6232
6233function keyDown(K)
6234 local Key = string.lower(K)
6235
6236 if Key == S.Keys.lowerStance and S.canChangeStance then
6237 if (not Running) then
6238 if Stance == 0 then
6239 if S.stanceSettings.Stances.Crouch then
6240 Crouch()
6241 elseif S.stanceSettings.Stances.Prone then
6242 Prone()
6243 end
6244 elseif Stance == 1 then
6245 if S.stanceSettings.Stances.Prone then
6246 Prone()
6247 end
6248 end
6249 elseif S.dolphinDive then
6250 wait()
6251 if Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and (not UIS:IsKeyDown("Space")) and runReady then
6252 local tempConnection = Humanoid.Changed:connect(function()
6253 Humanoid.Jump = false
6254 end)
6255 runReady = false
6256 Dive()
6257 Running = false
6258 wait(S.diveSettings.rechargeTime)
6259 tempConnection:disconnect()
6260 runReady = true
6261 end
6262 end
6263 end
6264
6265 if Key == S.Keys.raiseStance and S.canChangeStance then
6266 if (not Running) then
6267 if Stance == 2 then
6268 if S.stanceSettings.Stances.Crouch then
6269 Crouch()
6270 else
6271 Stand()
6272 end
6273 elseif Stance == 1 then
6274 Stand()
6275 end
6276 end
6277 end
6278
6279 if Key == S.Keys.ADS then
6280 if S.aimSettings.holdToADS then
6281 if (not AimingIn) and (not Aimed) then
6282 AimingIn = true
6283 aimGun()
6284 AimingIn = false
6285 end
6286 else
6287 if Aimed then
6288 unAimGun()
6289 else
6290 aimGun()
6291 end
6292 end
6293 end
6294
6295 if Key == S.Keys.selectFire and S.selectFire then
6296 if canSelectFire then
6297 canSelectFire = false
6298 rawFireMode = rawFireMode + 1
6299 modeGUI.Text = Modes[((rawFireMode - 1) % numModes) + 1]
6300 if modeGUI.Text == "AUTO" then
6301 fireFunction = autoFire
6302 elseif modeGUI.Text == "BURST" then
6303 fireFunction = burstFire
6304 elseif modeGUI.Text == "SEMI" then
6305 fireFunction = semiFire
6306 else
6307 fireFunction = nil
6308 end
6309 local speedAlpha = S.selectFireSettings.animSpeed / 0.6
6310 if S.selectFireSettings.GUI then
6311 spawn(function()
6312 fireSelect.Visible = true
6313 local prevRawFireMode = rawFireMode
6314 local Increment = 1.5 / (speedAlpha * 0.25)
6315 local X = 0
6316 wait(speedAlpha * 0.1)
6317 while true do
6318 RS.RenderStepped:wait()
6319 local newX = X + Increment
6320 X = (newX > 90 and 90 or newX)
6321 if prevRawFireMode ~= rawFireMode then break end
6322 updateModeLabels(rawFireMode - 1, rawFireMode, X)
6323 if X == 90 then break end
6324 end
6325 wait(speedAlpha * 0.25)
6326 fireSelect.Visible = false
6327 end)
6328 end
6329 if S.selectFireSettings.Animation and (not Aimed) and (not isRunning) and (not isCrawling) then
6330 spawn(function()
6331 local sequenceTable = {
6332 function()
6333 tweenJoint(RWeld2, nil, CFANG(0, RAD(5), 0), Sine, speedAlpha * 0.15)
6334 tweenJoint(LWeld, armC0[1], CF(0.1, 1, -0.3) * CFANG(RAD(-7), 0, RAD(-65)), Linear, speedAlpha * 0.15)
6335 wait(speedAlpha * 0.2)
6336 end;
6337
6338 function()
6339 tweenJoint(LWeld, armC0[1], CF(0.1, 1, -0.3) * CFANG(RAD(-10), 0, RAD(-65)), Linear, speedAlpha * 0.1)
6340 wait(speedAlpha * 0.2)
6341 end;
6342
6343 function()
6344 tweenJoint(RWeld2, nil, CF(), Sine, speedAlpha * 0.2)
6345 tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, speedAlpha * 0.2)
6346 wait(speedAlpha * 0.2)
6347 end;
6348 }
6349
6350 for _, F in pairs(sequenceTable) do
6351 if Aimed or isRunning or isCrawling or Reloading then
6352 break
6353 end
6354 F()
6355 end
6356 end)
6357 end
6358 if S.selectFireSettings.Animation or S.selectFireSettings.GUI then
6359 wait(S.selectFireSettings.animSpeed)
6360 end
6361 canSelectFire = true
6362 end
6363 end
6364
6365 if Key == S.Keys.Reload then
6366 if (not Reloading) and (not isCrawling) then
6367 Reload()
6368 end
6369 end
6370
6371 if Key == S.Keys.Sprint then
6372 runKeyPressed = true
6373 if runReady then
6374 if (not Idling) and Walking and (not Running) and (not Knifing) and (not (Aimed and S.guiScope and S.Keys.Sprint == S.Keys.scopeSteady)) then
6375 monitorStamina()
6376 end
6377 end
6378 end
6379
6380 if Key == S.Keys.scopeSteady then
6381 steadyKeyPressed = true
6382 if Aimed and (not Aiming) then
6383 takingBreath = false
6384 steadyCamera()
6385 end
6386 end
6387
6388 for _, PTable in pairs(Plugins.KeyDown) do
6389 if Key == string.lower(PTable.Key) then
6390 spawn(function()
6391 PTable.Plugin()
6392 end)
6393 end
6394 end
6395end
6396
6397function keyUp(K)
6398 local Key = string.lower(K)
6399
6400 if Key == S.Keys.ADS then
6401 if S.aimSettings.holdToADS then
6402 if (not AimingOut) and Aimed then
6403 AimingOut = true
6404 unAimGun()
6405 AimingOut = false
6406 end
6407 end
6408 end
6409
6410 if Key == S.Keys.Sprint then
6411 runKeyPressed = false
6412 Running = false
6413 if (not chargingStamina) then
6414 rechargeStamina()
6415 end
6416 end
6417
6418 if Key == S.Keys.scopeSteady then
6419 steadyKeyPressed = false
6420 end
6421
6422 for _, PTable in pairs(Plugins.KeyUp) do
6423 if Key == string.lower(PTable.Key) then
6424 spawn(function()
6425 PTable.Plugin()
6426 end)
6427 end
6428 end
6429end
6430
6431--------------------[ END FUNCTIONS ]-------------------------------------------------
6432
6433--------------------------------------------------------------------------------------
6434--------------------[ PRE-CONNECTIONS ]-----------------------------------------------
6435--------------------------------------------------------------------------------------
6436
6437local function updateAnimVars()
6438 wait()
6439 Forward = (UIS:IsKeyDown("W") or UIS:IsKeyDown("Up"))
6440 Backward = (UIS:IsKeyDown("S") or UIS:IsKeyDown("Down"))
6441 local Right = UIS:IsKeyDown("D")
6442 local Left = UIS:IsKeyDown("A")
6443
6444 local walkingForward = (Forward and (not Backward))
6445 local walkingBackward = ((not Forward) and Backward)
6446 local walkingRight = (Right and (not Left))
6447 local walkingLeft = ((not Right) and Left)
6448
6449 if (Forward or Backward or Right or Left) then
6450 Walking, Idling = true, false
6451 if (not Running) and (not Aimed) then
6452 spreadMotion = "Moving"
6453 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
6454 end
6455 elseif (not (Forward and Backward and Right and Left)) then
6456 Walking, Idling = false, true
6457 if (not Aimed) then
6458 spreadMotion = "Idling"
6459 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
6460 end
6461 end
6462
6463 local newArmTilt = (
6464 ((walkingForward or walkingBackward) and walkingRight) and 2.5 or
6465 ((walkingForward or walkingBackward) and walkingLeft) and -2.5 or
6466 ((not (walkingForward and walkingBackward)) and walkingRight) and 5 or
6467 ((not (walkingForward and walkingBackward)) and walkingLeft) and -5 or 0
6468 )
6469 local newMoveAng = (
6470 (walkingForward and (not (walkingRight or walkingLeft))) and 0 or
6471 (walkingForward and walkingRight) and RAD(-45) or
6472 ((not (walkingForward or walkingBackward)) and walkingRight) and RAD(-90) or
6473 (walkingBackward and walkingRight) and RAD(-135) or
6474 (walkingBackward and (not (walkingRight or walkingLeft))) and (moveAng < 0 and RAD(-180) or RAD(180)) or
6475 (walkingBackward and walkingLeft) and RAD(135) or
6476 ((not (walkingForward or walkingBackward)) and walkingLeft) and RAD(90) or
6477 (walkingForward and walkingLeft) and RAD(45) or 0
6478 )
6479
6480 local newAnimCode = math.random(-1e9, 1e9)
6481 animCode = newAnimCode
6482 local startTilt = armTilt
6483 local startAng = (ABS(moveAng) == RAD(180)) and (newMoveAng > 0 and RAD(180) or RAD(-180)) or moveAng
6484 local Increment = (startTilt == newArmTilt and 1.5 / 0.7 or 1.5 / (0.35 * ABS(startTilt - newArmTilt) / 5))
6485 local X = 0
6486 while true do
6487 RS.RenderStepped:wait()
6488 local newX = X + Increment
6489 X = (newX > 90 and 90 or newX)
6490 if animCode ~= newAnimCode then break end
6491 armTilt = numLerp(startTilt, newArmTilt, Sine(X))
6492 moveAng = numLerp(startAng, newMoveAng, Sine(X))
6493 if X == 90 then break end
6494 end
6495end
6496
6497M2.KeyDown:connect(updateAnimVars)
6498M2.KeyUp:connect(updateAnimVars)
6499updateAnimVars()
6500
6501--------------------------------------------------------------------------------------
6502--------------------[ TOOL SELECTION AND DESELECTION ]--------------------------------
6503--------------------------------------------------------------------------------------
6504
6505function onEquipped()
6506 wait()
6507 if Humanoid.Health ~= 0 and (not Selected) and Gun.Parent == Char then
6508 Selected = true
6509 breakReload = false
6510 equipAnimPlaying = true
6511
6512 math.randomseed(tick()) --This sets a new seed for the random function each time you select the gun
6513
6514 --------------------[ FAILSAFE RESETING ]-------------------------------------
6515
6516 for _, GM in pairs(ignoreModel:GetChildren()) do
6517 if GM.Name == "gunIgnore_"..Player.Name then
6518 GM:Destroy()
6519 end
6520 end
6521
6522 for _, c in pairs(Connections) do
6523 c:disconnect()
6524 end
6525
6526 Connections = {}
6527
6528 --------------------[ REMOTE GUN SETUP ]--------------------------------------
6529
6530 --[[local Vars = {
6531 ignoreModel = ignoreModel;
6532 Humanoid = Humanoid;
6533 Shoulders = Shoulders;
6534 Torso = Torso;
6535 Head = Head;
6536 armC0 = armC0;
6537 leftArmC1 = S.equipSettings.leftArmC1;
6538 rightArmC1 = S.equipSettings.rightArmC1;
6539 LArm = LArm;
6540 RArm = RArm;
6541 gunParts = gunParts;
6542 Handle = Handle;
6543 }
6544 gunIgnore, playerFolder, headWeld, headWeld2, animWeld, ABWeld, LWeld, RWeld, LWeld2, RWeld2, LLegWeld, RLegWeld, gunParts2 = gunSetup:InvokeServer(Vars)]]
6545
6546 --------------------[ CREATING IGNORE MODELS ]--------------------------------
6547
6548 gunIgnore = Instance.new("Model")
6549 gunIgnore.Name = "gunIgnore_"..Player.Name
6550 gunIgnore.Parent = ignoreModel
6551
6552 --------------------[ MODIFYING THE PLAYER ]----------------------------------
6553
6554 Player.CameraMode = Enum.CameraMode.LockFirstPerson
6555 Cam.CameraType = Enum.CameraType.Scriptable
6556 Cam.FieldOfView = 80
6557 UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
6558 UIS.MouseIconEnabled = false
6559
6560 local initialX, initialY = getYawPitch(Cam.CoordinateFrame)
6561 camAng = -VEC2(initialX, initialY)
6562
6563 mainGUI.Parent = Player.PlayerGui
6564
6565 setUpGUI()
6566 updateHealth()
6567
6568 if S.selectFire then
6569 local currentMode = Modes[((rawFireMode - 1) % numModes) + 1]
6570 if currentMode == "AUTO" then
6571 fireFunction = autoFire
6572 elseif currentMode == "BURST" then
6573 fireFunction = burstFire
6574 elseif currentMode == "SEMI" then
6575 fireFunction = semiFire
6576 else
6577 fireFunction = nil
6578 end
6579 else
6580 if S.gunType.Semi then
6581 fireFunction = semiFire
6582 elseif S.gunType.Auto then
6583 fireFunction = autoFire
6584 elseif S.gunType.Burst then
6585 fireFunction = burstFire
6586 else
6587 fireFunction = nil
6588 end
6589 end
6590
6591 changePlayerTrans(Char, 1)
6592
6593 Humanoid.AutoRotate = false
6594
6595 Shoulders.Right.Part1 = nil
6596 Shoulders.Left.Part1 = nil
6597
6598 playerFolder = Instance.new("Model")
6599 playerFolder.Name = "playerFolder"
6600 playerFolder.Parent = gunIgnore
6601
6602 local headBase = Instance.new("Part")
6603 headBase.Transparency = 1
6604 headBase.Name = "headBase"
6605 headBase.CanCollide = false
6606 headBase.FormFactor = Enum.FormFactor.Custom
6607 headBase.Size = V3(0.2, 0.2, 0.2)
6608 headBase.BottomSurface = Enum.SurfaceType.Smooth
6609 headBase.TopSurface = Enum.SurfaceType.Smooth
6610 headBase.Parent = playerFolder
6611
6612 headWeld = Instance.new("Weld")
6613 headWeld.Part0 = Torso
6614 headWeld.Part1 = headBase
6615 headWeld.C0 = CF(0, 1.5, 0)
6616 headWeld.Parent = Torso
6617
6618 headWeld2 = Instance.new("Weld")
6619 headWeld2.Part0 = headBase
6620 headWeld2.Part1 = Head
6621 headWeld2.Parent = headBase
6622
6623 neckClone = Neck:Clone()
6624
6625 --[[local stanceBase = Instance.new("Part")
6626 stanceBase.Transparency = 1
6627 stanceBase.Name = "stanceBase"
6628 stanceBase.CanCollide = false
6629 stanceBase.FormFactor = Enum.FormFactor.Custom
6630 stanceBase.Size = V3(0.2, 0.2, 0.2)
6631 stanceBase.BottomSurface = Enum.SurfaceType.Smooth
6632 stanceBase.TopSurface = Enum.SurfaceType.Smooth
6633 stanceBase.Parent = playerFolder
6634
6635 stanceWeld = Instance.new("Weld")
6636 stanceWeld.Part0 = stanceBase
6637 stanceWeld.Part1 = Torso
6638 stanceWeld.Parent = stanceBase]]
6639
6640 local animBase = Instance.new("Part")
6641 animBase.Transparency = 1
6642 animBase.Name = "animBase"
6643 animBase.CanCollide = false
6644 animBase.FormFactor = Enum.FormFactor.Custom
6645 animBase.Size = V3(0.2, 0.2, 0.2)
6646 animBase.BottomSurface = Enum.SurfaceType.Smooth
6647 animBase.TopSurface = Enum.SurfaceType.Smooth
6648 animBase.Parent = playerFolder
6649
6650 animWeld = Instance.new("Weld")
6651 animWeld.Part0 = animBase
6652 animWeld.Part1 = headBase
6653 animWeld.Parent = animBase
6654
6655 local ArmBase = Instance.new("Part")
6656 ArmBase.Transparency = 1
6657 ArmBase.Name = "ArmBase"
6658 ArmBase.CanCollide = false
6659 ArmBase.FormFactor = Enum.FormFactor.Custom
6660 ArmBase.Size = V3(0.2, 0.2, 0.2)
6661 ArmBase.BottomSurface = Enum.SurfaceType.Smooth
6662 ArmBase.TopSurface = Enum.SurfaceType.Smooth
6663 ArmBase.Parent = playerFolder
6664
6665 ABWeld = Instance.new("Weld")
6666 ABWeld.Part0 = ArmBase
6667 ABWeld.Part1 = animBase
6668 ABWeld.Parent = ArmBase
6669
6670 local LArmBase = Instance.new("Part")
6671 LArmBase.Transparency = 1
6672 LArmBase.Name = "LArmBase"
6673 LArmBase.CanCollide = false
6674 LArmBase.FormFactor = Enum.FormFactor.Custom
6675 LArmBase.Size = V3(0.2, 0.2, 0.2)
6676 LArmBase.BottomSurface = Enum.SurfaceType.Smooth
6677 LArmBase.TopSurface = Enum.SurfaceType.Smooth
6678 LArmBase.Parent = playerFolder
6679
6680 local RArmBase = Instance.new("Part")
6681 RArmBase.Transparency = 1
6682 RArmBase.Name = "RArmBase"
6683 RArmBase.CanCollide = false
6684 RArmBase.FormFactor = Enum.FormFactor.Custom
6685 RArmBase.Size = V3(0.2, 0.2, 0.2)
6686 RArmBase.BottomSurface = Enum.SurfaceType.Smooth
6687 RArmBase.TopSurface = Enum.SurfaceType.Smooth
6688 RArmBase.Parent = playerFolder
6689
6690 LWeld = Instance.new("Weld")
6691 LWeld.Name = "LWeld"
6692 LWeld.Part0 = ArmBase
6693 LWeld.Part1 = LArmBase
6694 LWeld.C0 = armC0[1]
6695 LWeld.C1 = S.equipSettings.leftArmC1
6696 LWeld.Parent = ArmBase
6697
6698 RWeld = Instance.new("Weld")
6699 RWeld.Name = "RWeld"
6700 RWeld.Part0 = ArmBase
6701 RWeld.Part1 = RArmBase
6702 RWeld.C0 = armC0[2]
6703 RWeld.C1 = S.equipSettings.rightArmC1
6704 RWeld.Parent = ArmBase
6705
6706 LWeld2 = Instance.new("Weld")
6707 LWeld2.Name = "LWeld"
6708 LWeld2.Part0 = LArmBase
6709 LWeld2.Part1 = LArm
6710 LWeld2.Parent = LArmBase
6711
6712 RWeld2 = Instance.new("Weld")
6713 RWeld2.Name = "RWeld"
6714 RWeld2.Part0 = RArmBase
6715 RWeld2.Part1 = RArm
6716 RWeld2.Parent = RArmBase
6717
6718 LLegWeld = Instance.new("Weld")
6719 LLegWeld.Name = "LLegWeld"
6720 LLegWeld.Part0 = Torso
6721 LLegWeld.Part1 = nil
6722 LLegWeld.C0 = CF(-0.5, -2, 0)
6723 LLegWeld.Parent = Torso
6724
6725 RLegWeld = Instance.new("Weld")
6726 RLegWeld.Name = "RLegWeld"
6727 RLegWeld.Part0 = Torso
6728 RLegWeld.Part1 = nil
6729 RLegWeld.C0 = CF(0.5, -2, 0)
6730 RLegWeld.Parent = Torso
6731
6732 if S.playerArms then
6733 armModel = Instance.new("Model", workspace.FilteringEnabled and playerFolder or Cam)
6734
6735 fakeLArm = LArm:Clone()
6736 fakeLArm.Parent = armModel
6737 fakeLArm.Transparency = S.fakeArmSettings.Transparency
6738 fakeLArm.CanCollide = false
6739 fakeLArm.Size = S.fakeArmSettings.armSize
6740 fakeLArm:BreakJoints()
6741
6742 --LArm.Transparency = 1
6743
6744 local fakeLWeld = Instance.new("Weld")
6745 fakeLWeld.Part0 = fakeLArm
6746 fakeLWeld.Part1 = LArm
6747 fakeLWeld.Parent = fakeLArm
6748
6749 fakeRArm = RArm:Clone()
6750 fakeRArm.Parent = armModel
6751 fakeRArm.Transparency = S.fakeArmSettings.Transparency
6752 fakeRArm.CanCollide = false
6753 fakeRArm.Size = S.fakeArmSettings.armSize
6754 fakeRArm:BreakJoints()
6755
6756 --RArm.Transparency = 1
6757
6758 local fakeRWeld = Instance.new("Weld")
6759 fakeRWeld.Part0 = fakeRArm
6760 fakeRWeld.Part1 = RArm
6761 fakeRWeld.Parent = fakeRArm
6762
6763 Instance.new("Humanoid", armModel)
6764
6765 if S.fakeArmSettings.characterMeshes then
6766 for _,Obj in pairs(Char:GetChildren()) do
6767 if Obj:IsA("CharacterMesh") then
6768 Obj:Clone().Parent = armModel
6769 end
6770 end
6771 end
6772 for _,Obj in pairs(Char:GetChildren()) do
6773 if Obj:IsA("Shirt") then
6774 Obj:Clone().Parent = armModel
6775 end
6776 end
6777 else
6778 armTable = createArms()
6779 if workspace.FilteringEnabled then
6780 armTable[1].Model.Parent = playerFolder
6781 armTable[2].Model.Parent = playerFolder
6782 else
6783 armTable[1].Model.Parent = Cam--playerFolder
6784 armTable[2].Model.Parent = Cam--playerFolder
6785 end
6786
6787 fakeLArm = armTable[1].armPart
6788
6789 --LArm.Transparency = 1
6790
6791 local fakeLWeld = Instance.new("Weld")
6792 fakeLWeld.Part0 = fakeLArm
6793 fakeLWeld.Part1 = LArm
6794 fakeLWeld.Parent = fakeLArm
6795
6796 fakeRArm = armTable[2].armPart
6797
6798 --RArm.Transparency = 1
6799
6800 local fakeRWeld = Instance.new("Weld")
6801 fakeRWeld.Part0 = fakeRArm
6802 fakeRWeld.Part1 = RArm
6803 fakeRWeld.Parent = fakeRArm
6804 end
6805
6806 --------------------[ MODIFYING THE GUN ]-------------------------------------
6807
6808 for _, Tab in pairs(gunParts) do
6809 local Weld = Instance.new("Weld")
6810 Weld.Name = "MainWeld"
6811 Weld.Part0 = Handle
6812 Weld.Part1 = Tab.Obj
6813 Weld.C0 = Tab.Obj.weldCF.Value
6814 Weld.Parent = Handle
6815 Tab.Weld = Weld
6816 end
6817
6818 Grip = RArm:WaitForChild("RightGrip")
6819
6820 local handleCF = Torso.CFrame * CF(0, 0.5, 0) * armC0[2] * S.aimedC1.rightArm:inverse() * Grip.C0
6821 local handleOffset = AimPart.CFrame:toObjectSpace(Handle.CFrame)
6822 aimedGripCF = ((Torso.CFrame * CF(headOffset.X, headOffset.Y, 0)) * handleOffset):toObjectSpace(handleCF)
6823
6824 Grip.C1 = S.equipSettings.GripC1
6825
6826 --------------------[ RUNNING PLUGINS ]---------------------------------------
6827
6828 for _, Plugin in pairs(Plugins.OnEquipped) do
6829 spawn(function()
6830 Plugin()
6831 end)
6832 end
6833
6834 --------------------[ GETTING PLAYER MASS ]-----------------------------------
6835
6836 local connectedParts = HRP:GetConnectedParts(true)
6837 for _, v in pairs(connectedParts) do
6838 if v:IsA("BasePart") then
6839 playerMass = playerMass + v:GetMass()
6840 end
6841 end
6842
6843 --------------------[ CONNECTIONS ]-------------------------------------------
6844
6845 INSERT(Connections, Humanoid.Died:connect(function()
6846 onUnequipped(true)
6847 end))
6848
6849 INSERT(Connections, Humanoid.Jumping:connect(function()
6850 if Stance ~= 0 then
6851 Stand()
6852 end
6853 end))
6854
6855 INSERT(Connections, Humanoid.StateChanged:connect(onHumanoidStateChanged))
6856
6857 INSERT(Connections, Humanoid.HealthChanged:connect(updateHealth))
6858
6859 INSERT(Connections, M2.Button1Down:connect(onMB1Down))
6860
6861 INSERT(Connections, M2.Button1Up:connect(onMB1Up))
6862
6863 INSERT(Connections, M2.Button2Down:connect(onMB2Down))
6864
6865 INSERT(Connections, M2.Button2Up:connect(onMB2Up))
6866
6867 INSERT(Connections, M2.KeyDown:connect(keyDown))
6868
6869 INSERT(Connections, M2.KeyUp:connect(keyUp))
6870
6871 if S.sensitivitySettings.scrollToChange then
6872 INSERT(Connections, M2.WheelForward:connect(onScrollUp))
6873 INSERT(Connections, M2.WheelBackward:connect(onScrollDown))
6874 end
6875
6876 if S.AutoKnife then
6877 INSERT(Connections, RS.Stepped:connect(function()
6878 local H, P = AdvRayCast(Head.CFrame.p, Head.CFrame.lookVector, S.AutoKnifeDist, nil)
6879 if H then
6880 local HitHuman = findFirstClass(H.Parent, "Humanoid")
6881 if HitHuman and isEnemy(HitHuman) and HitHuman.Health ~= 0 then
6882 Knife()
6883 end
6884 end
6885 end))
6886 end
6887
6888 INSERT(Connections, UIS.InputChanged:connect(function(inputObj)
6889 if inputObj.UserInputType == Enum.UserInputType.MouseMovement then
6890 local rawCamAng = camAng - (VEC2(RAD(inputObj.Delta.x), RAD(inputObj.Delta.y)) * mouseSensitivity * 0.25)
6891 camAng = VEC2(rawCamAng.x, (rawCamAng.y > RAD(80) and RAD(80) or rawCamAng.y < RAD(-80) and RAD(-80) or rawCamAng.y))
6892
6893 desiredXOffset = math.min(math.max(inputObj.Delta.x, -S.momentumSettings.maxInput), S.momentumSettings.maxInput)
6894 desiredYOffset = math.min(math.max(inputObj.Delta.y, -S.momentumSettings.maxInput), S.momentumSettings.maxInput)
6895 end
6896 end))
6897
6898 INSERT(Connections, M2.Idle:connect(function(inputObj)
6899 desiredXOffset = 0
6900 desiredYOffset = 0
6901 end))
6902
6903 INSERT(Connections, RS.Stepped:connect(function()
6904 if tick() - lastBeat > (Humanoid.Health / 75) then
6905 lastBeat = tick()
6906 HUD.Health.Tray.Beat:TweenPosition(
6907 UDim2.new(0, -21, 0, 0),
6908 Enum.EasingDirection.Out,
6909 Enum.EasingStyle.Linear,
6910 0.7 - ((100 - Humanoid.Health) / 400),
6911 false,
6912 function()
6913 HUD.Health.Tray.Beat.Position = UDim2.new(1, 0, 0, 0)
6914 end
6915 )
6916 end
6917 end))
6918
6919 INSERT(Connections, RS.RenderStepped:connect(function()
6920 --Main animation
6921 local animC0, animC1 = getAnimCF()
6922 animWeld.C0 = animC0
6923 animWeld.C1 = animC1
6924
6925 --Camera updating
6926 renderCamera()
6927 end))
6928
6929 --------------------[ ANIMATE GUN ]-------------------------------------------
6930
6931 tweenJoint(LWeld, nil, S.unAimedC1.leftArm, Sine, S.equipSettings.Time)
6932 tweenJoint(RWeld, nil, S.unAimedC1.rightArm, Sine, S.equipSettings.Time)
6933 tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, S.equipSettings.Time)
6934 spawn(function()
6935 local T = tick()
6936 while true do
6937 if tick() - T > S.equipSettings.Time then break end
6938 if (not Selected) then break end
6939 wait()
6940 end
6941 equipAnimPlaying = false
6942 end)
6943
6944 Animate()
6945 end
6946end
6947
6948function onUnequipped(deleteTool)
6949 if Selected then
6950 Selected = false
6951
6952 breakReload = true
6953
6954 --------------------[ RUNNING PLUGINS ]---------------------------------------
6955
6956 for _, Plugin in pairs(Plugins.OnUnEquipped) do
6957 spawn(function()
6958 Plugin()
6959 end)
6960 end
6961
6962 --------------------[ MODIFYING THE PLAYER ]----------------------------------
6963
6964 Cam.FieldOfView = 70
6965 Cam.CameraType = Enum.CameraType.Custom
6966
6967 UIS.MouseBehavior = Enum.MouseBehavior.Default
6968 UIS.MouseIconEnabled = true
6969
6970 Player.CameraMode = Enum.CameraMode.Classic
6971
6972 if armTable then
6973 armTable[1].Model:Destroy()
6974 armTable[2].Model:Destroy()
6975 elseif armModel then
6976 armModel:Destroy()
6977 end
6978
6979 LLegWeld:Destroy()
6980 RLegWeld:Destroy()
6981
6982 changePlayerTrans(Char, 0)
6983
6984 mainGUI.Parent = script
6985
6986 Shoulders.Right.Part1 = RArm
6987 Shoulders.Left.Part1 = LArm
6988
6989 neckClone.Parent = Torso
6990 headWeld:Destroy()
6991
6992 Humanoid.WalkSpeed = 16
6993 Humanoid.AutoRotate = true
6994
6995 --------------------[ RESETING THE TOOL ]-------------------------------------
6996
6997 gunIgnore:Destroy()
6998
6999 mouseSensitivity = S.sensitivitySettings.Default
7000
7001 MB1Down = false
7002
7003 playerMass = 0
7004
7005 Aimed = false
7006
7007 camOffsets = {
7008 guiScope = {
7009 Rot = V3();
7010 };
7011 Reload = {
7012 Rot = V3();
7013 Code = nil;
7014 };
7015 Recoil = {
7016 Rot = V3();
7017 Code = nil;
7018 };
7019 }
7020
7021 recoilAnim = {
7022 Pos = V3();
7023 Rot = V3();
7024 Code = nil;
7025 }
7026
7027 --Setting the aim variables to unaimed
7028 spreadZoom = "unAimed"
7029 scopeMain.Visible = false
7030 scopeSteady.Visible = false
7031 aimAlpha = 0
7032 aimHeadOffset = 0
7033 jumpAnimMultiplier = 1
7034 translationDivisor = 7
7035 rotationMultiplier = S.momentumSettings.Amplitude.unAimed
7036 armTiltMultiplier = 1
7037 Scope.BackgroundTransparency = 1
7038 if S.guiScope then
7039 spawn(function()
7040 for _, Obj in pairs(Gun:GetChildren()) do
7041 if Obj:IsA("BasePart") then
7042 Obj.LocalTransparencyModifier = 0
7043 end
7044 end
7045 end)
7046 end
7047
7048 onGround = true
7049
7050 for _, Tab in pairs(gunParts) do
7051 Tab.Weld:Destroy()
7052 Tab.Weld = nil
7053 end
7054
7055 for _,c in pairs(Connections) do
7056 c:disconnect()
7057 end
7058
7059 Connections = {}
7060
7061 if deleteTool then
7062 Cam:ClearAllChildren()
7063 Gun:Destroy()
7064 end
7065
7066 wait() --This is here in case you dolphin dived and deselected the tool instantly
7067
7068 if S.stanceSettings.standOnDeselect and Stance ~= 0 then
7069 crawlCamRot = 0
7070 isCrawling = false
7071 stanceSway = 1
7072 spreadStance = "Stand"
7073 Stand(true)
7074 end
7075 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
7076 end
7077end
7078
7079Gun.Equipped:connect(onEquipped)
7080Gun.Unequipped:connect(function() onUnequipped(false) end)
7081
7082--------------------------------------------------------------------------------------
7083--------------------[ END PROGRAM ]---------------------------------------------------
7084--------------------------------------------------------------------------------------
7085end))