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