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