Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Script0 = Instance.new("Script")
- Script1 = Instance.new("Script")
- Script2 = Instance.new("Script")
- Script3 = Instance.new("Script")
- Script0.Name = "ak47"
- Script0.Parent = mas
- table.insert(cors,sandbox(Script0,function()
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- --print("FE Compatibility code V2 by Mokiros")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- --//====================================================\\--
- --|| CREATED BY BRANNON1964802
- --\\====================================================//--
- wait(1 / 60)
- Player = game:GetService("Players").LocalPlayer
- PlayerGui = Player.PlayerGui
- Cam = workspace.CurrentCamera
- Backpack = Player.Backpack
- Character = Player.Character
- Humanoid = Character.Humanoid
- Mouse = Player:GetMouse()
- RootPart = Character["HumanoidRootPart"]
- Torso = Character["Torso"]
- Head = Character["Head"]
- Face = Head.face
- RightArm = Character["Right Arm"]
- LeftArm = Character["Left Arm"]
- RightLeg = Character["Right Leg"]
- LeftLeg = Character["Left Leg"]
- RootJoint = RootPart["RootJoint"]
- Neck = Torso["Neck"]
- RightShoulder = Torso["Right Shoulder"]
- LeftShoulder = Torso["Left Shoulder"]
- RightHip = Torso["Right Hip"]
- LeftHip = Torso["Left Hip"]
- IT = Instance.new
- CF = CFrame.new
- VT = Vector3.new
- RAD = math.rad
- C3 = Color3.new
- UD2 = UDim2.new
- BRICKC = BrickColor.new
- ANGLES = CFrame.Angles
- EULER = CFrame.fromEulerAnglesXYZ
- COS = math.cos
- ACOS = math.acos
- SIN = math.sin
- ASIN = math.asin
- ABS = math.abs
- ATAN = math.atan
- SIGN = math.sign
- FREXP = math.frexp
- MRANDOM = math.random
- FLOOR = math.floor
- MHUGE = math.huge
- NUMSEQ = NumberSequence.new
- NUMSEQKEYP = NumberSequenceKeypoint.new
- NUMRANGE = NumberRange.new
- COLORSEQ = ColorSequence.new
- COLORSEQKEYP = ColorSequenceKeypoint.new
- --//=================================\\
- --|| USEFUL VALUES
- --\\=================================//
- local EQUIPPED = false
- local GUNSTANCE = false
- local MOUSEDOWN = false
- local SMOKETIME = 0
- local GUNHANDLEOFFSET = nil
- local MAXBULLETS = 30
- local BULLETCOUNT = MAXBULLETS
- local BulletShellImpactSounds = {"1684805263", "1684805499", "1684805682", "1684805848", "1684806019", "1684806165", "1684806345", "1684806545"}
- local BulletImpactSounds = {"525719118", "525719147", "525719186", "525719232", "525719348", "525719399", "525719421", "525720445", "525720464", "525720500", "525720527", "525720556", "525720625", "525720650"}
- local gunshots = {"2290994834","2290995643","2290994062","2291001802"}
- --//=================================\\
- --||SOME FUNCTIONS AND WEAPON CREATION
- --\\=================================//
- local WeaponFolder = IT("Folder")
- WeaponFolder.Name = "Weapon"
- local EffectsFolder = workspace--[[IT("Folder")
- EffectsFolder.Name = "Effects"
- EffectsFolder.Parent = WeaponFolder--]]
- local GunHandlePart = IT("Part")
- GunHandlePart.Anchored = false
- GunHandlePart.FormFactor = "Custom"
- GunHandlePart.TopSurface, GunHandlePart.BottomSurface, GunHandlePart.RightSurface, GunHandlePart.LeftSurface, GunHandlePart.FrontSurface, GunHandlePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- GunHandlePart.Name = "Gun Handle Part"
- GunHandlePart.Material = "Plastic"
- GunHandlePart.Reflectance = 0
- GunHandlePart.Transparency = 0
- GunHandlePart.CanCollide = false
- GunHandlePart.Locked = true
- GunHandlePart.BrickColor = BRICKC("Black")
- GunHandlePart.Position = Torso.Position
- GunHandlePart.Size = VT(0.2, 0.2, 0.2)
- GunHandlePart:BreakJoints()
- GunHandlePart.Parent = WeaponFolder
- local GunHandleMesh = IT("SpecialMesh")
- GunHandleMesh.MeshType = "FileMesh"
- GunHandleMesh.MeshId = "rbxassetid://3824749"
- GunHandleMesh.TextureId = ""
- GunHandleMesh.Offset = VT(0, 0.15, -0.6)
- GunHandleMesh.Scale = VT(1.5, 1.5, 1.5)
- GunHandleMesh.Parent = GunHandlePart
- local GunHandleMotor = IT("Motor")
- GunHandleMotor.C0 = CF(0.5, 0, 0.55) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0))
- GunHandleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- GunHandleMotor.Part0 = Torso
- GunHandleMotor.Part1 = GunHandlePart
- GunHandleMotor.Parent = GunHandlePart
- local GunHolePart = IT("Part")
- GunHolePart.Anchored = false
- GunHolePart.FormFactor = "Custom"
- GunHolePart.TopSurface, GunHolePart.BottomSurface, GunHolePart.RightSurface, GunHolePart.LeftSurface, GunHolePart.FrontSurface, GunHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- GunHolePart.Name = "Gun Hole Part"
- GunHolePart.Material = "Plastic"
- GunHolePart.Reflectance = 0
- GunHolePart.Transparency = 1
- GunHolePart.CanCollide = false
- GunHolePart.Locked = true
- GunHolePart.BrickColor = BRICKC("Medium stone grey")
- GunHolePart.Position = Torso.Position
- GunHolePart.Size = VT(0, 0, 0)
- GunHolePart:BreakJoints()
- GunHolePart.Parent = WeaponFolder
- local GunHoleMotor = IT("Motor")
- GunHoleMotor.C0 = CF(0, 0.6, -3.35) * ANGLES(RAD(0), RAD(0), RAD(0))
- GunHoleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- GunHoleMotor.Part0 = GunHandlePart
- GunHoleMotor.Part1 = GunHolePart
- GunHoleMotor.Parent = GunHandlePart
- local GunShot = IT("Sound")
- GunShot.Looped = false
- GunShot.Volume = 1
- GunShot.Pitch = 1
- GunShot.SoundId = "rbxassetid://10209859" --10209798, 2920959, 10209859
- GunShot.Parent = GunHolePart
- -- 273794772 = Gun Holster/Unholster
- local GunUnholster = IT("Sound")
- GunUnholster.Looped = false
- GunUnholster.Volume = 1
- GunUnholster.Pitch = 1
- GunUnholster.SoundId = "rbxassetid://204223703" --609342351
- GunUnholster.Parent = GunHandlePart
- local GunHolster = IT("Sound")
- GunHolster.Looped = false
- GunHolster.Volume = 1
- GunHolster.Pitch = 1
- GunHolster.SoundId = "rbxassetid://204223703" --656142612, 1567552075, 202243557, 342864661, 204223703, 1244559077
- GunHolster.Parent = GunHandlePart
- local GunReload = IT("Sound")
- GunReload.Looped = false
- GunReload.Volume = 1
- GunReload.Pitch = 1
- GunReload.SoundId = "rbxassetid://10209869" --10209801, 2920960, 10209869, 2691591
- GunReload.Parent = GunHandlePart
- local GunChamberBack = IT("Sound")
- GunChamberBack.Looped = false
- GunChamberBack.Volume = 1
- GunChamberBack.Pitch = 1.2
- GunChamberBack.SoundId = "rbxassetid://363762296" --299287260 short version, 268377170 longer version
- GunChamberBack.Parent = GunHandlePart
- local GunChamberForward = IT("Sound")
- GunChamberForward.Looped = false
- GunChamberForward.Volume = 1
- GunChamberForward.Pitch = 1.2
- GunChamberForward.SoundId = "rbxassetid://364490777"
- GunChamberForward.Parent = GunHandlePart
- local GunSmoke = IT("ParticleEmitter")
- GunSmoke.Enabled = false
- GunSmoke.Texture = "rbxassetid://528256032"
- GunSmoke.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.1, 0.05
- ),
- NUMSEQKEYP(
- 1, 0.1, 0.05
- )
- }
- )
- GunSmoke.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.9, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- GunSmoke.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(255 / 255, 255 / 255, 255 / 255)
- ),
- COLORSEQKEYP(
- 1, C3(255 / 255, 255 / 255, 255 / 255)
- )
- }
- )
- GunSmoke.VelocitySpread = 360
- GunSmoke.Lifetime = NUMRANGE(1, 1)
- GunSmoke.Speed = NUMRANGE(0.5, 0.5)
- GunSmoke.Acceleration = VT(0, 2 * 5, 0)
- GunSmoke.Drag = 10
- GunSmoke.VelocityInheritance = 1
- GunSmoke.Rate = 1000
- GunSmoke.LightInfluence = 1
- GunSmoke.LightEmission = 0
- GunSmoke.ZOffset = 0.1
- GunSmoke.EmissionDirection = "Top"
- GunSmoke.Rotation = NUMRANGE(-360, 360)
- GunSmoke.RotSpeed = NUMRANGE(-10, 10)
- GunSmoke.LockedToPart = false
- GunSmoke.Parent = GunHolePart
- local GunShotEffect = IT("ParticleEmitter")
- GunShotEffect.Enabled = false
- GunShotEffect.Texture = "rbxassetid://243728166"
- GunShotEffect.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 1, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- GunShotEffect.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0
- ),
- NUMSEQKEYP(
- 1, 1
- )
- }
- )
- GunShotEffect.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(255 / 255, 170 / 255, 128 / 255)
- ),
- COLORSEQKEYP(
- 1, C3(255 / 255, 170 / 255, 128 / 255)
- )
- }
- )
- GunShotEffect.VelocitySpread = 0
- GunShotEffect.Lifetime = NUMRANGE(0.06, 0.06)
- GunShotEffect.Speed = NUMRANGE(0, 0)
- GunShotEffect.Acceleration = VT(0, 0, 0)
- GunShotEffect.Drag = 0
- GunShotEffect.VelocityInheritance = 0
- GunShotEffect.Rate = 0
- GunShotEffect.LightInfluence = 0
- GunShotEffect.LightEmission = 1
- GunShotEffect.ZOffset = 0.1
- GunShotEffect.EmissionDirection = "Top"
- GunShotEffect.Rotation = NUMRANGE(-360, 360)
- GunShotEffect.RotSpeed = NUMRANGE(0, 0)
- GunShotEffect.LockedToPart = true
- GunShotEffect.Parent = GunHolePart
- local GunLight = IT("PointLight")
- GunLight.Enabled = true
- GunLight.Brightness = 1000
- GunLight.Color = C3(255 / 255, 170 / 255, 128 / 255)
- GunLight.Shadows = true
- GunLight.Range = 0
- GunLight.Parent = GunHolePart
- local FakeRightShoulder = IT("Weld")
- FakeRightShoulder.Name = "Right Shoulder"
- FakeRightShoulder.Part0 = Torso
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeRightShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeRightShoulder.Part1 = RightArm
- local FakeLeftShoulder = IT("Weld")
- FakeLeftShoulder.Name = "Right Shoulder"
- FakeLeftShoulder.Part0 = Torso
- FakeLeftShoulder.C0 = CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeLeftShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeLeftShoulder.Part1 = LeftArm
- WeaponFolder.Parent = Character
- local function Clerp(INSTANCE, COORDINATE, TIME)
- return INSTANCE:lerp(COORDINATE, TIME)
- end
- local function RenderWait(TIME)
- if TIME == nil or TIME == 0 then
- game:GetService("RunService").Heartbeat:wait()
- else
- for i = 1, TIME do
- game:GetService("RunService").Heartbeat:wait()
- end
- end
- end
- local function EquipState(CURRENTSTATE)
- GUNSTANCE = true
- if CURRENTSTATE == true then
- RightShoulder.Parent = nil
- LeftShoulder.Parent = nil
- FakeRightShoulder.Parent = Torso
- FakeLeftShoulder.Parent = Torso
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(50 + 10 * i), RAD(0), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
- end
- GUNHANDLEOFFSET = RightArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
- GunHandleMotor.Part0 = RightArm
- GunHandleMotor.C0 = GUNHANDLEOFFSET
- Spawn(function()
- RenderWait()
- GunUnholster:Play()
- end)
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.6, 0) * ANGLES(RAD(-45 + 90 * i), RAD(0), RAD(45)) * ANGLES(RAD(0), RAD(-35 - 10 * i), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.6, 0) * ANGLES(RAD(35 + 10 * i), RAD(0), RAD(-35 - 10 * i)) * ANGLES(RAD(0), RAD(35 + 10 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
- end
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.5) * ANGLES(RAD(110 - 20 * i), RAD(0), RAD(0 - 30 * i)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(89 + 1 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0 - 30 * i), RAD(0)), i)
- end
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.5) * ANGLES(RAD(80 + 10 * i), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(89 + 1 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30))
- FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
- GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
- else
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(45 - 90 * i), RAD(0), RAD(45)) * ANGLES(RAD(0), RAD(-35 - 10 * i), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(45 - 10 * i), RAD(0), RAD(-45 + 10 * i)) * ANGLES(RAD(0), RAD(45 - 10 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunHolster:Play()
- end)
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(50 + 10 * i), RAD(0), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, GUNHANDLEOFFSET, i)
- end
- GUNHANDLEOFFSET = Torso.CFrame:toObjectSpace(GunHandlePart.CFrame)
- GunHandleMotor.Part0 = Torso
- GunHandleMotor.C0 = GUNHANDLEOFFSET
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(1 - 1 * i), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0.5, 0, 0.55) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0)), i)
- end
- FakeRightShoulder.Parent = nil
- FakeLeftShoulder.Parent = nil
- RightShoulder.Parent = Torso
- LeftShoulder.Parent = Torso
- GunHandleMotor.C0 = CF(0.5, 0, 0.55) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0))
- end
- GUNSTANCE = false
- end
- local function BulletHole(POSITION, EFFECTCOLOR)
- local BulletHolePart = IT("Part")
- BulletHolePart.Anchored = true
- BulletHolePart.FormFactor = "Custom"
- BulletHolePart.TopSurface, BulletHolePart.BottomSurface, BulletHolePart.RightSurface, BulletHolePart.LeftSurface, BulletHolePart.FrontSurface, BulletHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- BulletHolePart.Name = "Bullet Hole"
- BulletHolePart.Material = "Plastic"
- BulletHolePart.Reflectance = 0
- BulletHolePart.Transparency = 1
- BulletHolePart.CanCollide = false
- BulletHolePart.Locked = true
- BulletHolePart.BrickColor = BRICKC("Medium stone grey")
- BulletHolePart.Size = VT(0.2, 0, 0.2)
- BulletHolePart:BreakJoints()
- BulletHolePart.CFrame = POSITION
- BulletHolePart.Parent = EffectsFolder
- game:GetService("Debris"):AddItem(BulletHolePart, 3)
- local Success, BulletHoleDecal = pcall(
- function()
- local BulletHoleDecal = IT("Decal")
- BulletHoleDecal.Color3 = C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
- BulletHoleDecal.Face = "Top"
- BulletHoleDecal.Texture = "rbxassetid://359667865"
- BulletHoleDecal.Transparency = 0
- BulletHoleDecal.Parent = BulletHolePart
- return BulletHoleDecal
- end
- )
- local Success2, BulletHoleSound = pcall(
- function()
- local BulletHoleSound = IT("Sound")
- BulletHoleSound.Looped = false
- BulletHoleSound.Volume = 1
- BulletHoleSound.Pitch = MRANDOM(80, 120) / 100
- BulletHoleSound.SoundId = "rbxassetid://"..BulletImpactSounds[13]
- BulletHoleSound.Parent = BulletHolePart
- return BulletHoleSound
- end
- )
- local Success3, BulletHoleSound2 = pcall(
- function()
- local BulletHoleSound2 = IT("Sound")
- BulletHoleSound2.Looped = false
- BulletHoleSound2.Volume = 1
- BulletHoleSound2.Pitch = MRANDOM(80, 120) / 100
- BulletHoleSound2.SoundId = "rbxassetid://196864064"
- BulletHoleSound2.Parent = BulletHolePart
- return BulletHoleSound2
- end
- )
- local Success4, BulletImpactEffect = pcall(
- function()
- local BulletImpactEffect = IT("ParticleEmitter")
- BulletImpactEffect.Enabled = false
- BulletImpactEffect.Texture = "rbxassetid://241685484"
- BulletImpactEffect.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.05, 0.025
- ),
- NUMSEQKEYP(
- 1, 0.05, 0.025
- )
- }
- )
- BulletImpactEffect.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- BulletImpactEffect.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
- ),
- COLORSEQKEYP(
- 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
- )
- }
- )
- BulletImpactEffect.VelocitySpread = 45
- BulletImpactEffect.Lifetime = NUMRANGE(0.2, 0.2)
- BulletImpactEffect.Speed = NUMRANGE(30, 30)
- BulletImpactEffect.Acceleration = VT(0, -196.2, 0)
- BulletImpactEffect.Drag = 0
- BulletImpactEffect.VelocityInheritance = 0
- BulletImpactEffect.Rate = 0
- BulletImpactEffect.LightInfluence = 1
- BulletImpactEffect.LightEmission = 0
- BulletImpactEffect.ZOffset = 0
- BulletImpactEffect.EmissionDirection = "Top"
- BulletImpactEffect.Rotation = NUMRANGE(-360, 360)
- BulletImpactEffect.RotSpeed = NUMRANGE(-360, 360)
- BulletImpactEffect.LockedToPart = false
- BulletImpactEffect.Parent = BulletHolePart
- return BulletImpactEffect
- end
- )
- local Success5, BulletImpactEffect2 = pcall(
- function()
- local BulletImpactEffect2 = IT("ParticleEmitter")
- BulletImpactEffect2.Enabled = false
- BulletImpactEffect2.Texture = "rbxassetid://709137722"
- BulletImpactEffect2.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.5, 0
- ),
- NUMSEQKEYP(
- 1, 0.5, 0
- )
- }
- )
- BulletImpactEffect2.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- BulletImpactEffect2.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
- ),
- COLORSEQKEYP(
- 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
- )
- }
- )
- BulletImpactEffect2.VelocitySpread = 10
- BulletImpactEffect2.Lifetime = NUMRANGE(0.2, 0.2)
- BulletImpactEffect2.Speed = NUMRANGE(2, 2)
- BulletImpactEffect2.Acceleration = VT(0, 0, 0)
- BulletImpactEffect2.Drag = 0
- BulletImpactEffect2.VelocityInheritance = 0
- BulletImpactEffect2.Rate = 0
- BulletImpactEffect2.LightInfluence = 1
- BulletImpactEffect2.LightEmission = 0
- BulletImpactEffect2.ZOffset = 0.4
- BulletImpactEffect2.EmissionDirection = "Top"
- BulletImpactEffect2.Rotation = NUMRANGE(-360, 360)
- BulletImpactEffect2.RotSpeed = NUMRANGE(-360, 360)
- BulletImpactEffect2.LockedToPart = false
- BulletImpactEffect2.Parent = BulletHolePart
- return BulletImpactEffect2
- end
- )
- if Success or Success2 or Success3 or Success4 then
- Spawn(function()
- RenderWait()
- if Success4 then
- BulletImpactEffect:Emit(MRANDOM(5, 15))
- end
- if Success5 then
- BulletImpactEffect2:Emit(MRANDOM(1, 1))
- end
- if Success2 then
- BulletHoleSound:Play()
- end
- if Success3 then
- BulletHoleSound2:Play()
- end
- end)
- end
- end
- local function FakeBullet(POSITION, VELOCITY)
- local FakeBulletPart = IT("Part")
- FakeBulletPart.Anchored = false
- FakeBulletPart.FormFactor = "Custom"
- FakeBulletPart.TopSurface, FakeBulletPart.BottomSurface, FakeBulletPart.RightSurface, FakeBulletPart.LeftSurface, FakeBulletPart.FrontSurface, FakeBulletPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- FakeBulletPart.Name = "Bullet Shell"
- FakeBulletPart.Material = "Plastic"
- FakeBulletPart.Reflectance = 0
- FakeBulletPart.Transparency = 0
- FakeBulletPart.CanCollide = true
- FakeBulletPart.Locked = true
- FakeBulletPart.BrickColor = BRICKC("Bright yellow")
- FakeBulletPart.Size = VT(0.22, 0.12, 0.12)
- FakeBulletPart:BreakJoints()
- FakeBulletPart.CFrame = POSITION
- local FakeBulletMesh = IT("SpecialMesh")
- FakeBulletMesh.MeshType = "Cylinder"
- FakeBulletMesh.MeshId = ""
- FakeBulletMesh.TextureId = ""
- FakeBulletMesh.Offset = VT(0, 0, 0)
- FakeBulletMesh.Scale = VT(1, 1, 1)
- FakeBulletMesh.Parent = FakeBulletPart
- FakeBulletPart.Parent = EffectsFolder
- FakeBulletPart.Velocity = VELOCITY
- game:GetService("Debris"):AddItem(FakeBulletPart, 3)
- local Success, BulletContact = pcall(
- function()
- local BulletContact = IT("Sound")
- BulletContact.Looped = false
- BulletContact.Volume = 0.5
- BulletContact.Pitch = 1
- BulletContact.SoundId = "rbxassetid://"..BulletShellImpactSounds[5]
- BulletContact.Parent = FakeBulletPart
- return BulletContact
- end
- )
- if Success then
- local HITSOMETHING = false
- FakeBulletPart.Touched:connect(
- function()
- if HITSOMETHING == false then
- HITSOMETHING = true
- Spawn(
- function()
- RenderWait()
- BulletContact:Play()
- end
- )
- end
- end
- )
- end
- end
- local function FakeClip(POSITION, VELOCITY)
- local FakeClipPart = IT("Part")
- FakeClipPart.Anchored = false
- FakeClipPart.FormFactor = "Custom"
- FakeClipPart.TopSurface, FakeClipPart.BottomSurface, FakeClipPart.RightSurface, FakeClipPart.LeftSurface, FakeClipPart.FrontSurface, FakeClipPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- FakeClipPart.Name = "Clip"
- FakeClipPart.Material = "Plastic"
- FakeClipPart.Reflectance = 0
- FakeClipPart.Transparency = 0
- FakeClipPart.CanCollide = true
- FakeClipPart.Locked = true
- FakeClipPart.BrickColor = BRICKC("Black")
- FakeClipPart.Size = VT(0.08, 0.8, 0.3)
- FakeClipPart:BreakJoints()
- FakeClipPart.CFrame = POSITION
- FakeClipPart.Parent = EffectsFolder
- FakeClipPart.Velocity = VELOCITY
- game:GetService("Debris"):AddItem(FakeClipPart, 3)
- end
- local function ShootGun()
- GUNSTANCE = true
- local HITHUMANOID = nil
- Spawn(function()
- RenderWait()
- GunShot.Pitch = MRANDOM(90, 110) / 100
- GunShot:Play()
- if (BULLETCOUNT - 1) < 0 then
- GunChamberBack:Play()
- end
- end)
- GunShotEffect:Emit(MRANDOM(4, 6))
- GunLight.Range = 8
- FakeBullet(GunHandlePart.CFrame * CF(0, 0.75, -0.6) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20))), (GunHandlePart.CFrame * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(30), RAD(0), RAD(0))).lookVector * 20)
- BULLETCOUNT = BULLETCOUNT - 1
- local GUNSPREAD = VT(MRANDOM(-300, 300) / 100, MRANDOM(-300, 300) / 100, MRANDOM(-300, 300) / 100) * ((GunHolePart.Position - Mouse.Hit.p).magnitude / 100)
- local GUNRAYHIT, GUNRAYPOSITION, GUNRAYANGLE = game:GetService("Workspace").FindPartOnRay(game:GetService("Workspace"), Ray.new(GunHolePart.Position, (CF(GunHolePart.Position, Mouse.Hit.p + GUNSPREAD).lookVector).unit * 1000), Character)
- if GUNRAYHIT ~= nil then
- if GUNRAYHIT.Parent:FindFirstChild("Humanoid") then
- HITHUMANOID = GUNRAYHIT.Parent:FindFirstChild("Humanoid")
- else
- if GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid") then
- HITHUMANOID = GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid")
- end
- end
- if HITHUMANOID ~= nil and HITHUMANOID.Parent ~= Character then
- HITHUMANOID.Health = HITHUMANOID.Health - (HITHUMANOID.MaxHealth * (math.random(3,4)/10))
- else
- if not (GUNRAYHIT.Name == "Bullet Hole") then
- BulletHole(CF(GUNRAYPOSITION, GUNRAYPOSITION - GUNRAYANGLE) * ANGLES(RAD(90), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(MRANDOM(-360, 360)), RAD(0)), GUNRAYHIT.BrickColor)
- end
- end
- end
- SMOKETIME = 2
- for i = 0, 1, 0.35 do
- RenderWait()
- GunLight.Range = 8 - (8 * i)
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(0 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.6) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(0 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.4) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- GunLight.Range = 0
- for i = 0, 1, 0.35 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30))
- FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
- GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
- GUNSTANCE = false
- end
- local function ReloadGun()
- GUNSTANCE = true
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(0 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-5 + 10 * i), RAD(0), RAD(0)) * CF(-0.7, 0.5, -1) * ANGLES(RAD(90), RAD(0), RAD(70)) * ANGLES(RAD(0), RAD(0 - 10 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunReload:Play()
- end)
- FakeClip(GunHandlePart.CFrame * CF(0, 0, -0.67) * ANGLES(RAD(30), RAD(0), RAD(0)), (GunHandlePart.CFrame * ANGLES(RAD(-90), RAD(0), RAD(0))).lookVector * 10)
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(0 - 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(0 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-5 + 10 * i), RAD(0), RAD(0)) * CF(-0.7, 0.5, -1) * ANGLES(RAD(90), RAD(0), RAD(70)) * ANGLES(RAD(0), RAD(0 - 10 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- if BULLETCOUNT > 0 then
- GunReload:Stop()
- end
- if BULLETCOUNT <= 0 then
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.5) * ANGLES(RAD(70 - 10 * i), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(90)) * ANGLES(RAD(0), RAD(-59 - 1 * i), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(0 + 10 * i)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunChamberBack:Play()
- end)
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.5) * ANGLES(RAD(60), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(0), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(90)) * ANGLES(RAD(0), RAD(-60), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(10)) * CF(0, 0, -0.2), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunChamberForward:Play()
- end)
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.5) * ANGLES(RAD(60), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(90)) * ANGLES(RAD(0), RAD(-60), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(10)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- end
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30))
- FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
- GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
- BULLETCOUNT = MAXBULLETS
- GUNSTANCE = false
- end
- --//=================================\\
- --|| SET THINGS UP
- --\\=================================//
- Mouse.Button1Down:connect(function()
- MOUSEDOWN = true
- if GUNSTANCE == false and EQUIPPED == true then
- if BULLETCOUNT > 0 then
- Spawn(function()
- while MOUSEDOWN == true and BULLETCOUNT > 0 do
- if GUNSTANCE == false then
- ShootGun()
- end
- if MOUSEDOWN == false then
- break
- end
- RenderWait()
- end
- end)
- elseif BULLETCOUNT <= 0 then
- ReloadGun()
- end
- end
- end)
- Mouse.Button1Up:connect(function()
- MOUSEDOWN = false
- end)
- Mouse.KeyDown:connect(function(KEY)
- if KEY == "e" and GUNSTANCE == false then
- if EQUIPPED == false then
- EQUIPPED = true
- else
- EQUIPPED = false
- end
- EquipState(EQUIPPED)
- end
- if KEY == "r" and GUNSTANCE == false and EQUIPPED == true then
- ReloadGun()
- end
- end)
- --//=================================\\
- --|| WRAP THE WHOLE SCRIPT UP
- --\\=================================//
- while true do
- RenderWait()
- SMOKETIME = SMOKETIME - (1 / 30) / 2
- if SMOKETIME <= 0 then
- if GunSmoke.Enabled == true then
- GunSmoke.Enabled = false
- end
- else
- if GunSmoke.Enabled == false then
- GunSmoke.Enabled = true
- end
- end
- end
- --//====================================================\\--
- --|| END OF SCRIPT
- --\\====================================================//--
- end))
- Script1.Name = "pistol"
- Script1.Parent = mas
- table.insert(cors,sandbox(Script1,function()
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- --print("FE Compatibility code V2 by Mokiros")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- --//====================================================\\--
- --|| CREATED BY BRANNON1964802
- --\\====================================================//--
- wait(1 / 60)
- Player = game:GetService("Players").LocalPlayer
- PlayerGui = Player.PlayerGui
- Cam = workspace.CurrentCamera
- Backpack = Player.Backpack
- Character = Player.Character
- Humanoid = Character.Humanoid
- Mouse = Player:GetMouse()
- RootPart = Character["HumanoidRootPart"]
- Torso = Character["Torso"]
- Head = Character["Head"]
- Face = Head.face
- RightArm = Character["Right Arm"]
- LeftArm = Character["Left Arm"]
- RightLeg = Character["Right Leg"]
- LeftLeg = Character["Left Leg"]
- RootJoint = RootPart["RootJoint"]
- Neck = Torso["Neck"]
- RightShoulder = Torso["Right Shoulder"]
- LeftShoulder = Torso["Left Shoulder"]
- RightHip = Torso["Right Hip"]
- LeftHip = Torso["Left Hip"]
- IT = Instance.new
- CF = CFrame.new
- VT = Vector3.new
- RAD = math.rad
- C3 = Color3.new
- UD2 = UDim2.new
- BRICKC = BrickColor.new
- ANGLES = CFrame.Angles
- EULER = CFrame.fromEulerAnglesXYZ
- COS = math.cos
- ACOS = math.acos
- SIN = math.sin
- ASIN = math.asin
- ABS = math.abs
- ATAN = math.atan
- SIGN = math.sign
- FREXP = math.frexp
- MRANDOM = math.random
- FLOOR = math.floor
- MHUGE = math.huge
- NUMSEQ = NumberSequence.new
- NUMSEQKEYP = NumberSequenceKeypoint.new
- NUMRANGE = NumberRange.new
- COLORSEQ = ColorSequence.new
- COLORSEQKEYP = ColorSequenceKeypoint.new
- --//=================================\\
- --|| USEFUL VALUES
- --\\=================================//
- local EQUIPPED = false
- local GUNSTANCE = false
- local SMOKETIME = 0
- local GUNHANDLEOFFSET = nil
- local MAXBULLETS = 8
- local BULLETCOUNT = MAXBULLETS
- local BulletShellImpactSounds = {"1684805263", "1684805499", "1684805682", "1684805848", "1684806019", "1684806165", "1684806345", "1684806545"}
- local BulletImpactSounds = {"525719118", "525719147", "525719186", "525719232", "525719348", "525719399", "525719421", "525720445", "525720464", "525720500", "525720527", "525720556", "525720625", "525720650"}
- --//=================================\\
- --||SOME FUNCTIONS AND WEAPON CREATION
- --\\=================================//
- local WeaponFolder = IT("Folder")
- WeaponFolder.Name = "Weapon"
- local EffectsFolder = workspace--[[IT("Folder")
- EffectsFolder.Name = "Effects"
- EffectsFolder.Parent = WeaponFolder--]]
- local GunHandlePart = IT("Part")
- GunHandlePart.Anchored = false
- GunHandlePart.FormFactor = "Custom"
- GunHandlePart.TopSurface, GunHandlePart.BottomSurface, GunHandlePart.RightSurface, GunHandlePart.LeftSurface, GunHandlePart.FrontSurface, GunHandlePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- GunHandlePart.Name = "Gun Handle Part"
- GunHandlePart.Material = "Plastic"
- GunHandlePart.Reflectance = 0
- GunHandlePart.Transparency = 0
- GunHandlePart.CanCollide = false
- GunHandlePart.Locked = true
- GunHandlePart.BrickColor = BRICKC("Black")
- GunHandlePart.Position = Torso.Position
- GunHandlePart.Size = VT(0.2, 0.2, 0.2)
- GunHandlePart:BreakJoints()
- GunHandlePart.Parent = WeaponFolder
- local GunHandleMesh = IT("SpecialMesh")
- GunHandleMesh.MeshType = "FileMesh"
- GunHandleMesh.MeshId = "rbxassetid://4372594"
- GunHandleMesh.TextureId = ""
- GunHandleMesh.Offset = VT(0, 0.2, 0)
- GunHandleMesh.Scale = VT(1.2, 1.2, 1.2)
- GunHandleMesh.Parent = GunHandlePart
- local GunHandleMotor = IT("Motor")
- GunHandleMotor.C0 = CF(-1, -0.5, 0) * ANGLES(RAD(135), RAD(0), RAD(0))
- GunHandleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- GunHandleMotor.Part0 = Torso
- GunHandleMotor.Part1 = GunHandlePart
- GunHandleMotor.Parent = GunHandlePart
- local GunHolePart = IT("Part")
- GunHolePart.Anchored = false
- GunHolePart.FormFactor = "Custom"
- GunHolePart.TopSurface, GunHolePart.BottomSurface, GunHolePart.RightSurface, GunHolePart.LeftSurface, GunHolePart.FrontSurface, GunHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- GunHolePart.Name = "Gun Hole Part"
- GunHolePart.Material = "Plastic"
- GunHolePart.Reflectance = 0
- GunHolePart.Transparency = 1
- GunHolePart.CanCollide = false
- GunHolePart.Locked = true
- GunHolePart.BrickColor = BRICKC("Medium stone grey")
- GunHolePart.Position = Torso.Position
- GunHolePart.Size = VT(0, 0, 0)
- GunHolePart:BreakJoints()
- GunHolePart.Parent = WeaponFolder
- local GunHoleMotor = IT("Motor")
- GunHoleMotor.C0 = CF(0, 0.66, -0.8) * ANGLES(RAD(0), RAD(0), RAD(0))
- GunHoleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- GunHoleMotor.Part0 = GunHandlePart
- GunHoleMotor.Part1 = GunHolePart
- GunHoleMotor.Parent = GunHandlePart
- local GunShot = IT("Sound")
- GunShot.Looped = false
- GunShot.Volume = 1
- GunShot.Pitch = 1
- GunShot.SoundId = "rbxassetid://10209798" --10209798, 2920959, 10209859
- GunShot.Parent = GunHolePart
- -- 273794772 = Gun Holster/Unholster
- local GunUnholster = IT("Sound")
- GunUnholster.Looped = false
- GunUnholster.Volume = 1
- GunUnholster.Pitch = 1
- GunUnholster.SoundId = "rbxassetid://204223703" --609342351
- GunUnholster.Parent = GunHandlePart
- local GunHolster = IT("Sound")
- GunHolster.Looped = false
- GunHolster.Volume = 1
- GunHolster.Pitch = 1
- GunHolster.SoundId = "rbxassetid://204223703" --656142612, 1567552075, 202243557, 342864661, 204223703, 1244559077
- GunHolster.Parent = GunHandlePart
- local GunReload = IT("Sound")
- GunReload.Looped = false
- GunReload.Volume = 1
- GunReload.Pitch = 1
- GunReload.SoundId = "rbxassetid://10209801" --10209801, 2920960
- GunReload.Parent = GunHandlePart
- local GunChamberBack = IT("Sound")
- GunChamberBack.Looped = false
- GunChamberBack.Volume = 1
- GunChamberBack.Pitch = 1.4
- GunChamberBack.SoundId = "rbxassetid://363762296" --299287260 short version, 268377170 longer version
- GunChamberBack.Parent = GunHandlePart
- local GunChamberForward = IT("Sound")
- GunChamberForward.Looped = false
- GunChamberForward.Volume = 1
- GunChamberForward.Pitch = 1.4
- GunChamberForward.SoundId = "rbxassetid://364490777"
- GunChamberForward.Parent = GunHandlePart
- local GunSmoke = IT("ParticleEmitter")
- GunSmoke.Enabled = false
- GunSmoke.Texture = "rbxassetid://528256032"
- GunSmoke.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.1, 0.05
- ),
- NUMSEQKEYP(
- 1, 0.1, 0.05
- )
- }
- )
- GunSmoke.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.9, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- GunSmoke.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(255 / 255, 255 / 255, 255 / 255)
- ),
- COLORSEQKEYP(
- 1, C3(255 / 255, 255 / 255, 255 / 255)
- )
- }
- )
- GunSmoke.VelocitySpread = 360
- GunSmoke.Lifetime = NUMRANGE(1, 1)
- GunSmoke.Speed = NUMRANGE(0.5, 0.5)
- GunSmoke.Acceleration = VT(0, 2 * 5, 0)
- GunSmoke.Drag = 10
- GunSmoke.VelocityInheritance = 1
- GunSmoke.Rate = 1000
- GunSmoke.LightInfluence = 1
- GunSmoke.LightEmission = 0
- GunSmoke.ZOffset = 0.1
- GunSmoke.EmissionDirection = "Top"
- GunSmoke.Rotation = NUMRANGE(-360, 360)
- GunSmoke.RotSpeed = NUMRANGE(-10, 10)
- GunSmoke.LockedToPart = false
- GunSmoke.Parent = GunHolePart
- local GunShotEffect = IT("ParticleEmitter")
- GunShotEffect.Enabled = false
- GunShotEffect.Texture = "rbxassetid://243728166"
- GunShotEffect.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 1, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- GunShotEffect.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0
- ),
- NUMSEQKEYP(
- 1, 1
- )
- }
- )
- GunShotEffect.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(255 / 255, 170 / 255, 128 / 255)
- ),
- COLORSEQKEYP(
- 1, C3(255 / 255, 170 / 255, 128 / 255)
- )
- }
- )
- GunShotEffect.VelocitySpread = 0
- GunShotEffect.Lifetime = NUMRANGE(0.06, 0.06)
- GunShotEffect.Speed = NUMRANGE(0, 0)
- GunShotEffect.Acceleration = VT(0, 0, 0)
- GunShotEffect.Drag = 0
- GunShotEffect.VelocityInheritance = 0
- GunShotEffect.Rate = 0
- GunShotEffect.LightInfluence = 0
- GunShotEffect.LightEmission = 1
- GunShotEffect.ZOffset = 0.1
- GunShotEffect.EmissionDirection = "Top"
- GunShotEffect.Rotation = NUMRANGE(-360, 360)
- GunShotEffect.RotSpeed = NUMRANGE(0, 0)
- GunShotEffect.LockedToPart = true
- GunShotEffect.Parent = GunHolePart
- local GunLight = IT("PointLight")
- GunLight.Enabled = true
- GunLight.Brightness = 1000
- GunLight.Color = C3(255 / 255, 170 / 255, 128 / 255)
- GunLight.Shadows = true
- GunLight.Range = 0
- GunLight.Parent = GunHolePart
- local FakeRightShoulder = IT("Weld")
- FakeRightShoulder.Name = "Right Shoulder"
- FakeRightShoulder.Part0 = Torso
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeRightShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeRightShoulder.Part1 = RightArm
- local FakeLeftShoulder = IT("Weld")
- FakeLeftShoulder.Name = "Right Shoulder"
- FakeLeftShoulder.Part0 = Torso
- FakeLeftShoulder.C0 = CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeLeftShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeLeftShoulder.Part1 = LeftArm
- WeaponFolder.Parent = Character
- local function Clerp(INSTANCE, COORDINATE, TIME)
- return INSTANCE:lerp(COORDINATE, TIME)
- end
- local function RenderWait(TIME)
- if TIME == nil or TIME == 0 then
- game:GetService("RunService").Heartbeat:wait()
- else
- for i = 1, TIME do
- game:GetService("RunService").Heartbeat:wait()
- end
- end
- end
- local function EquipState(CURRENTSTATE)
- GUNSTANCE = true
- if CURRENTSTATE == true then
- RightShoulder.Parent = nil
- FakeRightShoulder.Parent = Torso
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(0.1 - 0.1 * i, 0, -1.1 + 0.1 * i) * ANGLES(RAD(90), RAD(0), RAD(-80 - 10 * i)) * ANGLES(RAD(-45), RAD(89 + 1 * i), RAD(0)), i)
- end
- GUNHANDLEOFFSET = RightArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
- GunHandleMotor.Part0 = RightArm
- GunHandleMotor.C0 = GUNHANDLEOFFSET
- Spawn(function()
- RenderWait()
- GunUnholster:Play()
- end)
- --[[
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(90)) * ANGLES(RAD(1 - 11 * i), RAD(0), RAD(0)), i)
- end
- --]]
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(100 - 10 * i), RAD(1 - 1 * i), RAD(10 - 10 * i)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
- end
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(90), RAD(0), RAD(0))
- GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0))
- else
- Spawn(function()
- RenderWait()
- GunHolster:Play()
- end)
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(0.1 - 0.1 * i, 0, -1.1 + 0.1 * i) * ANGLES(RAD(90), RAD(0), RAD(-80 - 10 * i)) * ANGLES(RAD(-45), RAD(89 + 1 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, GUNHANDLEOFFSET, i)
- end
- GUNHANDLEOFFSET = Torso.CFrame:toObjectSpace(GunHandlePart.CFrame)
- GunHandleMotor.Part0 = Torso
- GunHandleMotor.C0 = GUNHANDLEOFFSET
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(1 - 1 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(-1, -0.5, 0) * ANGLES(RAD(135), RAD(0), RAD(0)), i)
- end
- FakeRightShoulder.Parent = nil
- RightShoulder.Parent = Torso
- GunHandleMotor.C0 = CF(-1, -0.5, 0) * ANGLES(RAD(135), RAD(0), RAD(0))
- end
- GUNSTANCE = false
- end
- local function BulletHole(POSITION, EFFECTCOLOR)
- local BulletHolePart = IT("Part")
- BulletHolePart.Anchored = true
- BulletHolePart.FormFactor = "Custom"
- BulletHolePart.TopSurface, BulletHolePart.BottomSurface, BulletHolePart.RightSurface, BulletHolePart.LeftSurface, BulletHolePart.FrontSurface, BulletHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- BulletHolePart.Name = "Bullet Hole"
- BulletHolePart.Material = "Plastic"
- BulletHolePart.Reflectance = 0
- BulletHolePart.Transparency = 1
- BulletHolePart.CanCollide = false
- BulletHolePart.Locked = true
- BulletHolePart.BrickColor = BRICKC("Medium stone grey")
- BulletHolePart.Size = VT(0.3, 0, 0.3)
- BulletHolePart:BreakJoints()
- BulletHolePart.CFrame = POSITION
- BulletHolePart.Parent = EffectsFolder
- game:GetService("Debris"):AddItem(BulletHolePart, 5)
- local BulletHoleDecal = IT("Decal")
- BulletHoleDecal.Color3 = C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
- BulletHoleDecal.Face = "Top"
- BulletHoleDecal.Texture = "rbxassetid://359667865"
- BulletHoleDecal.Transparency = 0
- BulletHoleDecal.Parent = BulletHolePart
- local BulletHoleSound = IT("Sound")
- BulletHoleSound.Looped = false
- BulletHoleSound.Volume = 1
- BulletHoleSound.Pitch = MRANDOM(80, 120) / 100
- BulletHoleSound.SoundId = "rbxassetid://"..BulletImpactSounds[13]
- BulletHoleSound.Parent = BulletHolePart
- local BulletHoleSound2 = IT("Sound")
- BulletHoleSound2.Looped = false
- BulletHoleSound2.Volume = 1
- BulletHoleSound2.Pitch = MRANDOM(80, 120) / 100
- BulletHoleSound2.SoundId = "rbxassetid://196864064"
- BulletHoleSound2.Parent = BulletHolePart
- local BulletImpactEffect = IT("ParticleEmitter")
- BulletImpactEffect.Enabled = false
- BulletImpactEffect.Texture = "rbxassetid://241685484"
- BulletImpactEffect.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.05, 0.025
- ),
- NUMSEQKEYP(
- 1, 0.05, 0.025
- )
- }
- )
- BulletImpactEffect.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- BulletImpactEffect.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
- ),
- COLORSEQKEYP(
- 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
- )
- }
- )
- BulletImpactEffect.VelocitySpread = 45
- BulletImpactEffect.Lifetime = NUMRANGE(0.2, 0.2)
- BulletImpactEffect.Speed = NUMRANGE(30, 30)
- BulletImpactEffect.Acceleration = VT(0, -196.2, 0)
- BulletImpactEffect.Drag = 0
- BulletImpactEffect.VelocityInheritance = 0
- BulletImpactEffect.Rate = 0
- BulletImpactEffect.LightInfluence = 1
- BulletImpactEffect.LightEmission = 0
- BulletImpactEffect.ZOffset = 0
- BulletImpactEffect.EmissionDirection = "Top"
- BulletImpactEffect.Rotation = NUMRANGE(-360, 360)
- BulletImpactEffect.RotSpeed = NUMRANGE(-360, 360)
- BulletImpactEffect.LockedToPart = false
- BulletImpactEffect.Parent = BulletHolePart
- local BulletImpactEffect2 = IT("ParticleEmitter")
- BulletImpactEffect2.Enabled = false
- BulletImpactEffect2.Texture = "rbxassetid://709137722"
- BulletImpactEffect2.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.5, 0
- ),
- NUMSEQKEYP(
- 1, 0.5, 0
- )
- }
- )
- BulletImpactEffect2.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- BulletImpactEffect2.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
- ),
- COLORSEQKEYP(
- 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
- )
- }
- )
- BulletImpactEffect2.VelocitySpread = 10
- BulletImpactEffect2.Lifetime = NUMRANGE(0.2, 0.2)
- BulletImpactEffect2.Speed = NUMRANGE(2, 2)
- BulletImpactEffect2.Acceleration = VT(0, 0, 0)
- BulletImpactEffect2.Drag = 0
- BulletImpactEffect2.VelocityInheritance = 0
- BulletImpactEffect2.Rate = 0
- BulletImpactEffect2.LightInfluence = 1
- BulletImpactEffect2.LightEmission = 0
- BulletImpactEffect2.ZOffset = 0.4
- BulletImpactEffect2.EmissionDirection = "Top"
- BulletImpactEffect2.Rotation = NUMRANGE(-360, 360)
- BulletImpactEffect2.RotSpeed = NUMRANGE(-360, 360)
- BulletImpactEffect2.LockedToPart = false
- BulletImpactEffect2.Parent = BulletHolePart
- Spawn(function()
- RenderWait()
- BulletImpactEffect:Emit(MRANDOM(5, 15))
- BulletImpactEffect2:Emit(MRANDOM(1, 1))
- BulletHoleSound:Play()
- BulletHoleSound2:Play()
- end)
- end
- local function FakeBullet(POSITION, VELOCITY)
- local FakeBulletPart = IT("Part")
- FakeBulletPart.Anchored = false
- FakeBulletPart.FormFactor = "Custom"
- FakeBulletPart.TopSurface, FakeBulletPart.BottomSurface, FakeBulletPart.RightSurface, FakeBulletPart.LeftSurface, FakeBulletPart.FrontSurface, FakeBulletPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- FakeBulletPart.Name = "Bullet Shell"
- FakeBulletPart.Material = "Plastic"
- FakeBulletPart.Reflectance = 0
- FakeBulletPart.Transparency = 0
- FakeBulletPart.CanCollide = true
- FakeBulletPart.Locked = true
- FakeBulletPart.BrickColor = BRICKC("Bright yellow")
- FakeBulletPart.Size = VT(0.22, 0.12, 0.12)
- FakeBulletPart:BreakJoints()
- FakeBulletPart.CFrame = POSITION
- local FakeBulletMesh = IT("SpecialMesh")
- FakeBulletMesh.MeshType = "Cylinder"
- FakeBulletMesh.MeshId = ""
- FakeBulletMesh.TextureId = ""
- FakeBulletMesh.Offset = VT(0, 0, 0)
- FakeBulletMesh.Scale = VT(1, 1, 1)
- FakeBulletMesh.Parent = FakeBulletPart
- FakeBulletPart.Parent = EffectsFolder
- FakeBulletPart.Velocity = VELOCITY
- game:GetService("Debris"):AddItem(FakeBulletPart, 3)
- --[[
- local BulletContact = IT("Sound")
- BulletContact.Looped = false
- BulletContact.Volume = 0.5
- BulletContact.Pitch = 1
- BulletContact.SoundId = "rbxassetid://"..BulletShellImpactSounds[5]
- BulletContact.Parent = FakeBulletPart
- local HITSOMETHING = false
- FakeBulletPart.Touched:connect(function()
- if HITSOMETHING == false then
- HITSOMETHING = true
- Spawn(function()
- RenderWait()
- BulletContact:Play()
- end)
- end
- end)
- --]]
- end
- local function FakeClip(POSITION, VELOCITY)
- local FakeClipPart = IT("Part")
- FakeClipPart.Anchored = false
- FakeClipPart.FormFactor = "Custom"
- FakeClipPart.TopSurface, FakeClipPart.BottomSurface, FakeClipPart.RightSurface, FakeClipPart.LeftSurface, FakeClipPart.FrontSurface, FakeClipPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- FakeClipPart.Name = "Clip"
- FakeClipPart.Material = "Plastic"
- FakeClipPart.Reflectance = 0
- FakeClipPart.Transparency = 0
- FakeClipPart.CanCollide = true
- FakeClipPart.Locked = true
- FakeClipPart.BrickColor = BRICKC("Black")
- FakeClipPart.Size = VT(0.2, 0.8, 0.3)
- FakeClipPart:BreakJoints()
- FakeClipPart.CFrame = POSITION
- FakeClipPart.Parent = EffectsFolder
- FakeClipPart.Velocity = VELOCITY
- game:GetService("Debris"):AddItem(FakeClipPart, 3)
- end
- local function ShootGun()
- GUNSTANCE = true
- local HITHUMANOID = nil
- spawn(function()
- RenderWait()
- GunShot.Pitch = MRANDOM(90, 110) / 100
- GunShot:Play()
- if (BULLETCOUNT - 1) < 0 then
- GunChamberBack:Play()
- end
- end)
- GunShotEffect:Emit(MRANDOM(4, 6))
- GunLight.Range = 8
- FakeBullet(GunHandlePart.CFrame * CF(0, 0.7, -0.05) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20))), (GunHandlePart.CFrame * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(30), RAD(0), RAD(0))).lookVector * 20)
- BULLETCOUNT = BULLETCOUNT - 1
- local GUNSPREAD = VT(MRANDOM(-100, 100) / 100, MRANDOM(-100, 100) / 100, MRANDOM(-100, 100) / 100) * ((GunHolePart.Position - Mouse.Hit.p).magnitude / 100)
- local GUNRAYHIT, GUNRAYPOSITION, GUNRAYANGLE = game:GetService("Workspace").FindPartOnRay(game:GetService("Workspace"), Ray.new(GunHolePart.Position, (CF(GunHolePart.Position, Mouse.Hit.p + GUNSPREAD).lookVector).unit * 1000), Character)
- if GUNRAYHIT ~= nil then
- if GUNRAYHIT.Parent:FindFirstChild("Humanoid") then
- HITHUMANOID = GUNRAYHIT.Parent:FindFirstChild("Humanoid")
- else
- if GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid") then
- HITHUMANOID = GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid")
- end
- end
- if HITHUMANOID ~= nil and HITHUMANOID.Parent ~= Character then
- HITHUMANOID.Health = HITHUMANOID.Health - (HITHUMANOID.MaxHealth * (math.random(2,3)/10))
- else
- BulletHole(CF(GUNRAYPOSITION, GUNRAYPOSITION - GUNRAYANGLE) * ANGLES(RAD(90), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(MRANDOM(-360, 360)), RAD(0)), GUNRAYHIT.BrickColor)
- end
- end
- SMOKETIME = 2
- for i = 0, 1, 0.2 do
- RenderWait()
- GunLight.Range = 8 - (8 * i)
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.1) * ANGLES(RAD(90 + 10 * i), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
- end
- GunLight.Range = 0
- for i = 0, 1, 0.2 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(100 - 10 * i), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
- end
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(90), RAD(0), RAD(0))
- GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0))
- GUNSTANCE = false
- end
- local function ReloadGun()
- GUNSTANCE = true
- Spawn(function()
- RenderWait()
- GunReload:Play()
- end)
- FakeClip(GunHandlePart.CFrame * CF(0, 0, 0.45) * ANGLES(RAD(-15), RAD(0), RAD(0)), (GunHandlePart.CFrame * ANGLES(RAD(-90), RAD(0), RAD(0))).lookVector * 10)
- for i = 0, 1, 0.04 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(125 + 10 * i), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90 + 390 * i), RAD(0), RAD(0)) * CF(0, -0.2, -0.4), i)
- end
- for i = 0, 1, 0.06 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90 - 30 * i), RAD(0), RAD(0)) * CF(0, -0.2, -0.4), i)
- end
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(125 + 10 * i), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90 + 390 * i), RAD(0), RAD(0)) * CF(0, -0.2, -0.4), i)
- end
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(100 - 10 * i), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-60 - 30 * i), RAD(0), RAD(0)), i)
- end
- if BULLETCOUNT <= 0 then
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(90 + 10 * i), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(10), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunChamberForward:Play()
- end)
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(80 + 10 * i), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(-10 + 10 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
- end
- end
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(90), RAD(0), RAD(0))
- GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0))
- BULLETCOUNT = MAXBULLETS
- GUNSTANCE = false
- end
- --//=================================\\
- --|| SET THINGS UP
- --\\=================================//
- Mouse.Button1Down:connect(function()
- if GUNSTANCE == false and EQUIPPED == true then
- if BULLETCOUNT > 0 then
- ShootGun()
- elseif BULLETCOUNT <= 0 then
- ReloadGun()
- end
- end
- end)
- Mouse.KeyDown:connect(function(KEY)
- if KEY == "q" and GUNSTANCE == false then
- if EQUIPPED == false then
- EQUIPPED = true
- else
- EQUIPPED = false
- end
- EquipState(EQUIPPED)
- end
- if KEY == "r" and GUNSTANCE == false and EQUIPPED == true then
- ReloadGun()
- end
- end)
- --//=================================\\
- --|| WRAP THE WHOLE SCRIPT UP
- --\\=================================//
- while true do
- RenderWait()
- SMOKETIME = SMOKETIME - (1 / 30) / 2
- if SMOKETIME <= 0 then
- if GunSmoke.Enabled == true then
- GunSmoke.Enabled = false
- end
- else
- if GunSmoke.Enabled == false then
- GunSmoke.Enabled = true
- end
- end
- end
- --//====================================================\\--
- --|| END OF SCRIPT
- --\\====================================================//--
- end))
- Script2.Name = "shotgun"
- Script2.Parent = mas
- table.insert(cors,sandbox(Script2,function()
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- --print("FE Compatibility code V2 by Mokiros")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- --//====================================================\\--
- --|| CREATED BY BRANNON1964802
- --\\====================================================//--
- wait(1 / 60)
- Player = game:GetService("Players").LocalPlayer
- PlayerGui = Player.PlayerGui
- Cam = workspace.CurrentCamera
- Backpack = Player.Backpack
- Character = Player.Character
- Humanoid = Character.Humanoid
- Mouse = Player:GetMouse()
- RootPart = Character["HumanoidRootPart"]
- Torso = Character["Torso"]
- Head = Character["Head"]
- Face = Head.face
- RightArm = Character["Right Arm"]
- LeftArm = Character["Left Arm"]
- RightLeg = Character["Right Leg"]
- LeftLeg = Character["Left Leg"]
- RootJoint = RootPart["RootJoint"]
- Neck = Torso["Neck"]
- RightShoulder = Torso["Right Shoulder"]
- LeftShoulder = Torso["Left Shoulder"]
- RightHip = Torso["Right Hip"]
- LeftHip = Torso["Left Hip"]
- IT = Instance.new
- CF = CFrame.new
- VT = Vector3.new
- RAD = math.rad
- C3 = Color3.new
- UD2 = UDim2.new
- BRICKC = BrickColor.new
- ANGLES = CFrame.Angles
- EULER = CFrame.fromEulerAnglesXYZ
- COS = math.cos
- ACOS = math.acos
- SIN = math.sin
- ASIN = math.asin
- ABS = math.abs
- ATAN = math.atan
- SIGN = math.sign
- FREXP = math.frexp
- MRANDOM = math.random
- FLOOR = math.floor
- MHUGE = math.huge
- NUMSEQ = NumberSequence.new
- NUMSEQKEYP = NumberSequenceKeypoint.new
- NUMRANGE = NumberRange.new
- COLORSEQ = ColorSequence.new
- COLORSEQKEYP = ColorSequenceKeypoint.new
- --//=================================\\
- --|| USEFUL VALUES
- --\\=================================//
- local EQUIPPED = false
- local GUNSTANCE = false
- local MOUSEDOWN = false
- local MOUSEDOWN2 = false
- local CHAMBEREMPTY = false
- local SMOKETIME = 0
- local GUNHANDLEOFFSET = nil
- local MAXBULLETS = 6
- local BULLETCOUNT = MAXBULLETS
- local BulletShellImpactSounds = {"1684805263", "1684805499", "1684805682", "1684805848", "1684806019", "1684806165", "1684806345", "1684806545"}
- local BulletImpactSounds = {"525719118", "525719147", "525719186", "525719232", "525719348", "525719399", "525719421", "525720445", "525720464", "525720500", "525720527", "525720556", "525720625", "525720650"}
- --//=================================\\
- --||SOME FUNCTIONS AND WEAPON CREATION
- --\\=================================//
- local WeaponFolder = IT("Folder")
- WeaponFolder.Name = "Weapon"
- local EffectsFolder = workspace--[[IT("Folder")
- EffectsFolder.Name = "Effects"
- EffectsFolder.Parent = WeaponFolder--]]
- local GunHandlePart = IT("Part")
- GunHandlePart.Anchored = false
- GunHandlePart.FormFactor = "Custom"
- GunHandlePart.TopSurface, GunHandlePart.BottomSurface, GunHandlePart.RightSurface, GunHandlePart.LeftSurface, GunHandlePart.FrontSurface, GunHandlePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- GunHandlePart.Name = "Gun Handle Part"
- GunHandlePart.Material = "Plastic"
- GunHandlePart.Reflectance = 0
- GunHandlePart.Transparency = 0
- GunHandlePart.CanCollide = false
- GunHandlePart.Locked = true
- GunHandlePart.BrickColor = BRICKC("Black")
- GunHandlePart.Position = Torso.Position
- GunHandlePart.Size = VT(0.2, 0.2, 0.2)
- GunHandlePart:BreakJoints()
- GunHandlePart.Parent = WeaponFolder
- local GunHandleMesh = IT("SpecialMesh")
- GunHandleMesh.MeshType = "FileMesh"
- GunHandleMesh.MeshId = "rbxassetid://3835506"
- GunHandleMesh.TextureId = ""
- GunHandleMesh.Offset = VT(0, 0.3, -0.6)
- GunHandleMesh.Scale = VT(1.2, 1.2, 1)
- GunHandleMesh.Parent = GunHandlePart
- local GunHandleMotor = IT("Motor")
- GunHandleMotor.C0 = CF(0.5, 0, 0.55) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0))
- GunHandleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- GunHandleMotor.Part0 = Torso
- GunHandleMotor.Part1 = GunHandlePart
- GunHandleMotor.Parent = GunHandlePart
- local GunHolePart = IT("Part")
- GunHolePart.Anchored = false
- GunHolePart.FormFactor = "Custom"
- GunHolePart.TopSurface, GunHolePart.BottomSurface, GunHolePart.RightSurface, GunHolePart.LeftSurface, GunHolePart.FrontSurface, GunHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- GunHolePart.Name = "Gun Hole Part"
- GunHolePart.Material = "Plastic"
- GunHolePart.Reflectance = 0
- GunHolePart.Transparency = 1
- GunHolePart.CanCollide = false
- GunHolePart.Locked = true
- GunHolePart.BrickColor = BRICKC("Medium stone grey")
- GunHolePart.Position = Torso.Position
- GunHolePart.Size = VT(0, 0, 0)
- GunHolePart:BreakJoints()
- GunHolePart.Parent = WeaponFolder
- local GunHoleMotor = IT("Motor")
- GunHoleMotor.C0 = CF(0, 0.73, -3.1) * ANGLES(RAD(0), RAD(0), RAD(0))
- GunHoleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- GunHoleMotor.Part0 = GunHandlePart
- GunHoleMotor.Part1 = GunHolePart
- GunHoleMotor.Parent = GunHandlePart
- local GunShot = IT("Sound")
- GunShot.Looped = false
- GunShot.Volume = 1
- GunShot.Pitch = 1
- GunShot.SoundId = "rbxassetid://10209842" --10209798, 2920959, 10209859
- GunShot.Parent = GunHolePart
- -- 273794772 = Gun Holster/Unholster
- local GunUnholster = IT("Sound")
- GunUnholster.Looped = false
- GunUnholster.Volume = 1
- GunUnholster.Pitch = 1
- GunUnholster.SoundId = "rbxassetid://204223703" --609342351
- GunUnholster.Parent = GunHandlePart
- local GunHolster = IT("Sound")
- GunHolster.Looped = false
- GunHolster.Volume = 1
- GunHolster.Pitch = 1
- GunHolster.SoundId = "rbxassetid://204223703" --656142612, 1567552075, 202243557, 342864661, 204223703, 1244559077
- GunHolster.Parent = GunHandlePart
- local GunReload = IT("Sound")
- GunReload.Looped = false
- GunReload.Volume = 1
- GunReload.Pitch = 1
- GunReload.SoundId = "rbxassetid://10209834" --10209801, 2920960, 10209869, 2691591
- GunReload.Parent = GunHandlePart
- local GunChamberBack = IT("Sound")
- GunChamberBack.Looped = false
- GunChamberBack.Volume = 1
- GunChamberBack.Pitch = 1
- GunChamberBack.SoundId = "rbxassetid://363762296" --299287260 short version, 268377170 longer version
- GunChamberBack.Parent = GunHandlePart
- local GunChamberForward = IT("Sound")
- GunChamberForward.Looped = false
- GunChamberForward.Volume = 1
- GunChamberForward.Pitch = 1
- GunChamberForward.SoundId = "rbxassetid://364490777"
- GunChamberForward.Parent = GunHandlePart
- local GunSmoke = IT("ParticleEmitter")
- GunSmoke.Enabled = false
- GunSmoke.Texture = "rbxassetid://528256032"
- GunSmoke.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.1, 0.05
- ),
- NUMSEQKEYP(
- 1, 0.1, 0.05
- )
- }
- )
- GunSmoke.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.9, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- GunSmoke.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(255 / 255, 255 / 255, 255 / 255)
- ),
- COLORSEQKEYP(
- 1, C3(255 / 255, 255 / 255, 255 / 255)
- )
- }
- )
- GunSmoke.VelocitySpread = 360
- GunSmoke.Lifetime = NUMRANGE(1, 1)
- GunSmoke.Speed = NUMRANGE(0.5, 0.5)
- GunSmoke.Acceleration = VT(0, 2 * 5, 0)
- GunSmoke.Drag = 10
- GunSmoke.VelocityInheritance = 1
- GunSmoke.Rate = 1000
- GunSmoke.LightInfluence = 1
- GunSmoke.LightEmission = 0
- GunSmoke.ZOffset = 0.1
- GunSmoke.EmissionDirection = "Top"
- GunSmoke.Rotation = NUMRANGE(-360, 360)
- GunSmoke.RotSpeed = NUMRANGE(-10, 10)
- GunSmoke.LockedToPart = false
- GunSmoke.Parent = GunHolePart
- local GunShotEffect = IT("ParticleEmitter")
- GunShotEffect.Enabled = false
- GunShotEffect.Texture = "rbxassetid://243728166"
- GunShotEffect.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 1, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- GunShotEffect.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0
- ),
- NUMSEQKEYP(
- 1, 1
- )
- }
- )
- GunShotEffect.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(255 / 255, 170 / 255, 128 / 255)
- ),
- COLORSEQKEYP(
- 1, C3(255 / 255, 170 / 255, 128 / 255)
- )
- }
- )
- GunShotEffect.VelocitySpread = 0
- GunShotEffect.Lifetime = NUMRANGE(0.06, 0.06)
- GunShotEffect.Speed = NUMRANGE(0, 0)
- GunShotEffect.Acceleration = VT(0, 0, 0)
- GunShotEffect.Drag = 0
- GunShotEffect.VelocityInheritance = 0
- GunShotEffect.Rate = 0
- GunShotEffect.LightInfluence = 0
- GunShotEffect.LightEmission = 1
- GunShotEffect.ZOffset = 0.1
- GunShotEffect.EmissionDirection = "Top"
- GunShotEffect.Rotation = NUMRANGE(-360, 360)
- GunShotEffect.RotSpeed = NUMRANGE(0, 0)
- GunShotEffect.LockedToPart = true
- GunShotEffect.Parent = GunHolePart
- local GunLight = IT("PointLight")
- GunLight.Enabled = true
- GunLight.Brightness = 1000
- GunLight.Color = C3(255 / 255, 170 / 255, 128 / 255)
- GunLight.Shadows = true
- GunLight.Range = 0
- GunLight.Parent = GunHolePart
- local FakeRightShoulder = IT("Weld")
- FakeRightShoulder.Name = "Right Shoulder"
- FakeRightShoulder.Part0 = Torso
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeRightShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeRightShoulder.Part1 = RightArm
- local FakeLeftShoulder = IT("Weld")
- FakeLeftShoulder.Name = "Right Shoulder"
- FakeLeftShoulder.Part0 = Torso
- FakeLeftShoulder.C0 = CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeLeftShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeLeftShoulder.Part1 = LeftArm
- WeaponFolder.Parent = Character
- local function Clerp(INSTANCE, COORDINATE, TIME)
- return INSTANCE:lerp(COORDINATE, TIME)
- end
- local function RenderWait(TIME)
- if TIME == nil or TIME == 0 then
- game:GetService("RunService").Heartbeat:wait()
- else
- for i = 1, TIME do
- game:GetService("RunService").Heartbeat:wait()
- end
- end
- end
- local function EquipState(CURRENTSTATE)
- GUNSTANCE = true
- if CURRENTSTATE == true then
- RightShoulder.Parent = nil
- LeftShoulder.Parent = nil
- FakeRightShoulder.Parent = Torso
- FakeLeftShoulder.Parent = Torso
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(50 + 10 * i), RAD(0), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
- end
- GUNHANDLEOFFSET = RightArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
- GunHandleMotor.Part0 = RightArm
- GunHandleMotor.C0 = GUNHANDLEOFFSET
- Spawn(function()
- RenderWait()
- GunUnholster:Play()
- end)
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45 + 135 * i), RAD(0), RAD(45)) * ANGLES(RAD(0), RAD(-35 - 10 * i), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(35 + 10 * i), RAD(0), RAD(-35 - 10 * i)) * ANGLES(RAD(0), RAD(35 + 10 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
- end
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.4, 0.8) * ANGLES(RAD(135 - 45 * i), RAD(0), RAD(45 - 75 * i)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.4, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(89 + 1 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0 - 30 * i), RAD(0)), i)
- end
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.8) * ANGLES(RAD(80 + 10 * i), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30))
- FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
- GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
- else
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(45 - 90 * i), RAD(0), RAD(45)) * ANGLES(RAD(0), RAD(-35 - 10 * i), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(45 - 10 * i), RAD(0), RAD(-45 + 10 * i)) * ANGLES(RAD(0), RAD(45 - 10 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunHolster:Play()
- end)
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(50 + 10 * i), RAD(0), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, GUNHANDLEOFFSET, i)
- end
- GUNHANDLEOFFSET = Torso.CFrame:toObjectSpace(GunHandlePart.CFrame)
- GunHandleMotor.Part0 = Torso
- GunHandleMotor.C0 = GUNHANDLEOFFSET
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(1 - 1 * i), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0.5, 0, 0.55) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0)), i)
- end
- FakeRightShoulder.Parent = nil
- FakeLeftShoulder.Parent = nil
- RightShoulder.Parent = Torso
- LeftShoulder.Parent = Torso
- GunHandleMotor.C0 = CF(0.5, 0, 0.55) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0))
- end
- GUNSTANCE = false
- end
- local function BulletHole(POSITION, EFFECTCOLOR)
- local BulletHolePart = IT("Part")
- BulletHolePart.Anchored = true
- BulletHolePart.FormFactor = "Custom"
- BulletHolePart.TopSurface, BulletHolePart.BottomSurface, BulletHolePart.RightSurface, BulletHolePart.LeftSurface, BulletHolePart.FrontSurface, BulletHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- BulletHolePart.Name = "Bullet Hole"
- BulletHolePart.Material = "Plastic"
- BulletHolePart.Reflectance = 0
- BulletHolePart.Transparency = 1
- BulletHolePart.CanCollide = false
- BulletHolePart.Locked = true
- BulletHolePart.BrickColor = BRICKC("Medium stone grey")
- BulletHolePart.Size = VT(0.2, 0, 0.2)
- BulletHolePart:BreakJoints()
- BulletHolePart.CFrame = POSITION
- BulletHolePart.Parent = EffectsFolder
- game:GetService("Debris"):AddItem(BulletHolePart, 2)
- local BulletHoleDecal = IT("Decal")
- BulletHoleDecal.Color3 = C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
- BulletHoleDecal.Face = "Top"
- BulletHoleDecal.Texture = "rbxassetid://359667865"
- BulletHoleDecal.Transparency = 0
- BulletHoleDecal.Parent = BulletHolePart
- local BulletHoleSound = IT("Sound")
- BulletHoleSound.Looped = false
- BulletHoleSound.Volume = 1
- BulletHoleSound.Pitch = MRANDOM(80, 120) / 100
- BulletHoleSound.SoundId = "rbxassetid://"..BulletImpactSounds[13]
- BulletHoleSound.Parent = BulletHolePart
- local BulletHoleSound2 = IT("Sound")
- BulletHoleSound2.Looped = false
- BulletHoleSound2.Volume = 1
- BulletHoleSound2.Pitch = MRANDOM(80, 120) / 100
- BulletHoleSound2.SoundId = "rbxassetid://196864064"
- BulletHoleSound2.Parent = BulletHolePart
- local BulletImpactEffect = IT("ParticleEmitter")
- BulletImpactEffect.Enabled = false
- BulletImpactEffect.Texture = "rbxassetid://241685484"
- BulletImpactEffect.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.05, 0.025
- ),
- NUMSEQKEYP(
- 1, 0.05, 0.025
- )
- }
- )
- BulletImpactEffect.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- BulletImpactEffect.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
- ),
- COLORSEQKEYP(
- 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
- )
- }
- )
- BulletImpactEffect.VelocitySpread = 45
- BulletImpactEffect.Lifetime = NUMRANGE(0.2, 0.2)
- BulletImpactEffect.Speed = NUMRANGE(30, 30)
- BulletImpactEffect.Acceleration = VT(0, -196.2, 0)
- BulletImpactEffect.Drag = 0
- BulletImpactEffect.VelocityInheritance = 0
- BulletImpactEffect.Rate = 0
- BulletImpactEffect.LightInfluence = 1
- BulletImpactEffect.LightEmission = 0
- BulletImpactEffect.ZOffset = 0
- BulletImpactEffect.EmissionDirection = "Top"
- BulletImpactEffect.Rotation = NUMRANGE(-360, 360)
- BulletImpactEffect.RotSpeed = NUMRANGE(-360, 360)
- BulletImpactEffect.LockedToPart = false
- BulletImpactEffect.Parent = BulletHolePart
- local BulletImpactEffect2 = IT("ParticleEmitter")
- BulletImpactEffect2.Enabled = false
- BulletImpactEffect2.Texture = "rbxassetid://709137722"
- BulletImpactEffect2.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.5, 0
- ),
- NUMSEQKEYP(
- 1, 0.5, 0
- )
- }
- )
- BulletImpactEffect2.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- BulletImpactEffect2.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
- ),
- COLORSEQKEYP(
- 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
- )
- }
- )
- BulletImpactEffect2.VelocitySpread = 10
- BulletImpactEffect2.Lifetime = NUMRANGE(0.2, 0.2)
- BulletImpactEffect2.Speed = NUMRANGE(2, 2)
- BulletImpactEffect2.Acceleration = VT(0, 0, 0)
- BulletImpactEffect2.Drag = 0
- BulletImpactEffect2.VelocityInheritance = 0
- BulletImpactEffect2.Rate = 0
- BulletImpactEffect2.LightInfluence = 1
- BulletImpactEffect2.LightEmission = 0
- BulletImpactEffect2.ZOffset = 0.4
- BulletImpactEffect2.EmissionDirection = "Top"
- BulletImpactEffect2.Rotation = NUMRANGE(-360, 360)
- BulletImpactEffect2.RotSpeed = NUMRANGE(-360, 360)
- BulletImpactEffect2.LockedToPart = false
- BulletImpactEffect2.Parent = BulletHolePart
- Spawn(function()
- RenderWait()
- BulletImpactEffect:Emit(MRANDOM(5, 15))
- BulletImpactEffect2:Emit(MRANDOM(1, 1))
- BulletHoleSound:Play()
- BulletHoleSound2:Play()
- end)
- end
- local function FakeBullet(POSITION, VELOCITY)
- local FakeBulletPart = IT("Part")
- FakeBulletPart.Anchored = false
- FakeBulletPart.FormFactor = "Custom"
- FakeBulletPart.TopSurface, FakeBulletPart.BottomSurface, FakeBulletPart.RightSurface, FakeBulletPart.LeftSurface, FakeBulletPart.FrontSurface, FakeBulletPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- FakeBulletPart.Name = "Bullet Shell"
- FakeBulletPart.Material = "Plastic"
- FakeBulletPart.Reflectance = 0
- FakeBulletPart.Transparency = 0
- FakeBulletPart.CanCollide = true
- FakeBulletPart.Locked = true
- FakeBulletPart.BrickColor = BRICKC("Bright red")
- FakeBulletPart.Size = VT(0.22, 0.12, 0.12)
- FakeBulletPart:BreakJoints()
- FakeBulletPart.CFrame = POSITION
- local FakeBulletMesh = IT("SpecialMesh")
- FakeBulletMesh.MeshType = "Cylinder"
- FakeBulletMesh.MeshId = ""
- FakeBulletMesh.TextureId = ""
- FakeBulletMesh.Offset = VT(0, 0, 0)
- FakeBulletMesh.Scale = VT(1, 1, 1)
- FakeBulletMesh.Parent = FakeBulletPart
- FakeBulletPart.Parent = EffectsFolder
- FakeBulletPart.Velocity = VELOCITY
- game:GetService("Debris"):AddItem(FakeBulletPart, 3)
- --[[
- local BulletContact = IT("Sound")
- BulletContact.Looped = false
- BulletContact.Volume = 0.5
- BulletContact.Pitch = 1
- BulletContact.SoundId = "rbxassetid://"..BulletShellImpactSounds[5]
- BulletContact.Parent = FakeBulletPart
- local HITSOMETHING = false
- FakeBulletPart.Touched:connect(function()
- if HITSOMETHING == false then
- HITSOMETHING = true
- Spawn(function()
- RenderWait()
- BulletContact:Play()
- end)
- end
- end)
- --]]
- end
- local function FakeClip(POSITION, VELOCITY)
- local FakeClipPart = IT("Part")
- FakeClipPart.Anchored = false
- FakeClipPart.FormFactor = "Custom"
- FakeClipPart.TopSurface, FakeClipPart.BottomSurface, FakeClipPart.RightSurface, FakeClipPart.LeftSurface, FakeClipPart.FrontSurface, FakeClipPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- FakeClipPart.Name = "Clip"
- FakeClipPart.Material = "Plastic"
- FakeClipPart.Reflectance = 0
- FakeClipPart.Transparency = 0
- FakeClipPart.CanCollide = true
- FakeClipPart.Locked = true
- FakeClipPart.BrickColor = BRICKC("Black")
- FakeClipPart.Size = VT(0.08, 0.8, 0.3)
- FakeClipPart:BreakJoints()
- FakeClipPart.CFrame = POSITION
- FakeClipPart.Parent = EffectsFolder
- FakeClipPart.Velocity = VELOCITY
- game:GetService("Debris"):AddItem(FakeClipPart, 3)
- end
- local function ShootGun()
- GUNSTANCE = true
- local HITHUMANOID = nil
- spawn(function()
- RenderWait()
- GunShot.Pitch = MRANDOM(90, 110) / 100
- GunShot:Play()
- end)
- GunShotEffect:Emit(MRANDOM(4, 6))
- GunLight.Range = 8
- BULLETCOUNT = BULLETCOUNT - 1
- for i = 1, 9 do
- local GUNSPREAD = VT(MRANDOM(-2000, 2000) / 100, MRANDOM(-2000, 2000) / 100, MRANDOM(-2000, 2000) / 100) * ((GunHolePart.Position - Mouse.Hit.p).magnitude / 100)
- local GUNRAY = Ray.new(GunHolePart.Position, (CF(GunHolePart.Position, Mouse.Hit.p + GUNSPREAD).lookVector).unit * 1000)
- local GUNRAYHIT, GUNRAYPOSITION, GUNRAYANGLE = game:GetService("Workspace"):FindPartOnRay(GUNRAY, Character)
- if GUNRAYHIT ~= nil then
- if GUNRAYHIT.Parent:FindFirstChild("Humanoid") then
- HITHUMANOID = GUNRAYHIT.Parent:FindFirstChild("Humanoid")
- else
- if GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid") then
- HITHUMANOID = GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid")
- end
- end
- if HITHUMANOID ~= nil and HITHUMANOID.Parent ~= Character then
- HITHUMANOID.Health = HITHUMANOID.Health - (HITHUMANOID.MaxHealth * 0.3)
- else
- BulletHole(CF(GUNRAYPOSITION, GUNRAYPOSITION - GUNRAYANGLE) * ANGLES(RAD(90), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(MRANDOM(-360, 360)), RAD(0)), GUNRAYHIT.BrickColor)
- end
- end
- end
- SMOKETIME = 2
- for i = 0, 1, 0.08 do
- RenderWait()
- GunLight.Range = 8 - (8 * i)
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 1) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.3) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunChamberBack:Play()
- wait(1 * 0.008)
- GunChamberForward:Play()
- end)
- GunLight.Range = 0
- FakeBullet(GunHandlePart.CFrame * CF(0, 0.75, -0.6) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20))), (GunHandlePart.CFrame * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(30), RAD(0), RAD(0))).lookVector * 20)
- for i = 0, 1, 0.08 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(20 - 20 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(20 - 20 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -0.8 - 0.7 * i) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30))
- FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
- GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
- GUNSTANCE = false
- end
- local function ReloadGun()
- GUNSTANCE = true
- MOUSEDOWN = false
- MOUSEDOWN2 = false
- if BULLETCOUNT <= 0 then
- CHAMBEREMPTY = true
- end
- while MOUSEDOWN2 ~= true and BULLETCOUNT < MAXBULLETS do
- for i = 0, 1, 0.06 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(110 + 10 * i), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- if MOUSEDOWN == true then
- MOUSEDOWN2 = true
- end
- end
- Spawn(function()
- RenderWait()
- GunReload:Play()
- end)
- --FakeClip(GunHandlePart.CFrame * CF(0, 0, -0.67) * ANGLES(RAD(30), RAD(0), RAD(0)), (GunHandlePart.CFrame * ANGLES(RAD(-90), RAD(0), RAD(0))).lookVector * 10)
- for i = 0, 1, 0.06 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(130 - 10 * i), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(40 - 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1 - 0.3 * i) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(59 + 1 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- if MOUSEDOWN == true then
- MOUSEDOWN2 = true
- end
- end
- if BULLETCOUNT < MAXBULLETS then
- BULLETCOUNT = BULLETCOUNT + 1
- else
- BULLETCOUNT = MAXBULLETS
- end
- if MOUSEDOWN2 == true or BULLETCOUNT >= MAXBULLETS then
- break
- end
- end
- for i = 0, 1, 0.08 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.8) * ANGLES(RAD(80 + 10 * i), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- if BULLETCOUNT > 0 then
- GunReload:Stop()
- end
- if CHAMBEREMPTY == true then
- CHAMBEREMPTY = false
- Spawn(function()
- RenderWait()
- GunChamberBack:Play()
- wait(1 * 0.008)
- GunChamberForward:Play()
- end)
- for i = 0, 1, 0.08 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(20 - 20 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(20 - 20 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -0.8 - 0.7 * i) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- end
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30))
- FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
- GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
- MOUSEDOWN2 = false
- GUNSTANCE = false
- end
- --//=================================\\
- --|| SET THINGS UP
- --\\=================================//
- Mouse.Button1Down:connect(function()
- MOUSEDOWN = true
- if GUNSTANCE == false and EQUIPPED == true then
- if BULLETCOUNT > 0 then
- ShootGun()
- elseif BULLETCOUNT <= 0 then
- ReloadGun()
- end
- end
- end)
- Mouse.Button1Up:connect(function()
- MOUSEDOWN = false
- end)
- Mouse.KeyDown:connect(function(KEY)
- if KEY == "t" and GUNSTANCE == false then
- if EQUIPPED == false then
- EQUIPPED = true
- else
- EQUIPPED = false
- end
- EquipState(EQUIPPED)
- end
- if KEY == "r" and GUNSTANCE == false and EQUIPPED == true and BULLETCOUNT < MAXBULLETS then
- ReloadGun()
- end
- end)
- --//=================================\\
- --|| WRAP THE WHOLE SCRIPT UP
- --\\=================================//
- while true do
- RenderWait()
- SMOKETIME = SMOKETIME - (1 / 30) / 2
- if SMOKETIME <= 0 then
- if GunSmoke.Enabled == true then
- GunSmoke.Enabled = false
- end
- else
- if GunSmoke.Enabled == false then
- GunSmoke.Enabled = true
- end
- end
- end
- --//====================================================\\--
- --|| END OF SCRIPT
- --\\====================================================//--
- end))
- Script3.Name = "sniper"
- Script3.Parent = mas
- table.insert(cors,sandbox(Script3,function()
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- --print("FE Compatibility code V2 by Mokiros")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- --//====================================================\\--
- --|| CREATED BY BRANNON1964802
- --\\====================================================//--
- wait(1 / 60)
- Player = game:GetService("Players").LocalPlayer
- PlayerGui = Player.PlayerGui
- Cam = workspace.CurrentCamera
- Backpack = Player.Backpack
- Character = Player.Character
- Humanoid = Character.Humanoid
- Mouse = Player:GetMouse()
- RootPart = Character["HumanoidRootPart"]
- Torso = Character["Torso"]
- Head = Character["Head"]
- Face = Head.face
- RightArm = Character["Right Arm"]
- LeftArm = Character["Left Arm"]
- RightLeg = Character["Right Leg"]
- LeftLeg = Character["Left Leg"]
- RootJoint = RootPart["RootJoint"]
- Neck = Torso["Neck"]
- RightShoulder = Torso["Right Shoulder"]
- LeftShoulder = Torso["Left Shoulder"]
- RightHip = Torso["Right Hip"]
- LeftHip = Torso["Left Hip"]
- IT = Instance.new
- CF = CFrame.new
- VT = Vector3.new
- RAD = math.rad
- C3 = Color3.new
- UD2 = UDim2.new
- BRICKC = BrickColor.new
- ANGLES = CFrame.Angles
- EULER = CFrame.fromEulerAnglesXYZ
- COS = math.cos
- ACOS = math.acos
- SIN = math.sin
- ASIN = math.asin
- ABS = math.abs
- ATAN = math.atan
- SIGN = math.sign
- FREXP = math.frexp
- MRANDOM = math.random
- FLOOR = math.floor
- MHUGE = math.huge
- NUMSEQ = NumberSequence.new
- NUMSEQKEYP = NumberSequenceKeypoint.new
- NUMRANGE = NumberRange.new
- COLORSEQ = ColorSequence.new
- COLORSEQKEYP = ColorSequenceKeypoint.new
- --//=================================\\
- --|| USEFUL VALUES
- --\\=================================//
- local EQUIPPED = false
- local GUNSTANCE = false
- local CHAMBEREMPTY = false
- local SMOKETIME = 0
- local GUNHANDLEOFFSET = nil
- local MAXBULLETS = 5
- local BULLETCOUNT = MAXBULLETS
- local BulletShellImpactSounds = {"1684805263", "1684805499", "1684805682", "1684805848", "1684806019", "1684806165", "1684806345", "1684806545"}
- local BulletImpactSounds = {"525719118", "525719147", "525719186", "525719232", "525719348", "525719399", "525719421", "525720445", "525720464", "525720500", "525720527", "525720556", "525720625", "525720650"}
- --//=================================\\
- --||SOME FUNCTIONS AND WEAPON CREATION
- --\\=================================//
- local WeaponFolder = IT("Folder")
- WeaponFolder.Name = "Weapon"
- local EffectsFolder = workspace--[[IT("Folder")
- EffectsFolder.Name = "Effects"
- EffectsFolder.Parent = WeaponFolder--]]
- local GunHandlePart = IT("Part")
- GunHandlePart.Anchored = false
- GunHandlePart.FormFactor = "Custom"
- GunHandlePart.TopSurface, GunHandlePart.BottomSurface, GunHandlePart.RightSurface, GunHandlePart.LeftSurface, GunHandlePart.FrontSurface, GunHandlePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- GunHandlePart.Name = "Gun Handle Part"
- GunHandlePart.Material = "Plastic"
- GunHandlePart.Reflectance = 0
- GunHandlePart.Transparency = 0
- GunHandlePart.CanCollide = false
- GunHandlePart.Locked = true
- GunHandlePart.BrickColor = BRICKC("Black")
- GunHandlePart.Position = Torso.Position
- GunHandlePart.Size = VT(0.2, 0.2, 0.2)
- GunHandlePart:BreakJoints()
- GunHandlePart.Parent = WeaponFolder
- local GunHandleMesh = IT("SpecialMesh")
- GunHandleMesh.MeshType = "FileMesh"
- GunHandleMesh.MeshId = "rbxassetid://2761723"
- GunHandleMesh.TextureId = ""
- GunHandleMesh.Offset = VT(0, 0.4, -1.4)
- GunHandleMesh.Scale = VT(0.6, 0.6, 0.6)
- GunHandleMesh.Parent = GunHandlePart
- local GunHandleMotor = IT("Motor")
- GunHandleMotor.C0 = CF(1, 0.4, 0.7) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0))
- GunHandleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- GunHandleMotor.Part0 = Torso
- GunHandleMotor.Part1 = GunHandlePart
- GunHandleMotor.Parent = GunHandlePart
- local GunHolePart = IT("Part")
- GunHolePart.Anchored = false
- GunHolePart.FormFactor = "Custom"
- GunHolePart.TopSurface, GunHolePart.BottomSurface, GunHolePart.RightSurface, GunHolePart.LeftSurface, GunHolePart.FrontSurface, GunHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- GunHolePart.Name = "Gun Hole Part"
- GunHolePart.Material = "Plastic"
- GunHolePart.Reflectance = 0
- GunHolePart.Transparency = 1
- GunHolePart.CanCollide = false
- GunHolePart.Locked = true
- GunHolePart.BrickColor = BRICKC("Medium stone grey")
- GunHolePart.Position = Torso.Position
- GunHolePart.Size = VT(0, 0, 0)
- GunHolePart:BreakJoints()
- GunHolePart.Parent = WeaponFolder
- local GunHoleMotor = IT("Motor")
- GunHoleMotor.C0 = CF(0.03, 0.55, -4.95) * ANGLES(RAD(0), RAD(0), RAD(0))
- GunHoleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- GunHoleMotor.Part0 = GunHandlePart
- GunHoleMotor.Part1 = GunHolePart
- GunHoleMotor.Parent = GunHandlePart
- local GunShot = IT("Sound")
- GunShot.Looped = false
- GunShot.Volume = 1
- GunShot.Pitch = 1
- GunShot.SoundId = "rbxassetid://492961938" --10209798, 2920959, 10209859
- GunShot.Parent = GunHolePart
- -- 273794772 = Gun Holster/Unholster
- local GunUnholster = IT("Sound")
- GunUnholster.Looped = false
- GunUnholster.Volume = 1
- GunUnholster.Pitch = 1
- GunUnholster.SoundId = "rbxassetid://204223703" --609342351
- GunUnholster.Parent = GunHandlePart
- local GunHolster = IT("Sound")
- GunHolster.Looped = false
- GunHolster.Volume = 1
- GunHolster.Pitch = 1
- GunHolster.SoundId = "rbxassetid://204223703" --656142612, 1567552075, 202243557, 342864661, 204223703, 1244559077
- GunHolster.Parent = GunHandlePart
- local GunReload = IT("Sound")
- GunReload.Looped = false
- GunReload.Volume = 1
- GunReload.Pitch = 0.6
- GunReload.SoundId = "rbxassetid://10209834" --10209801, 2920960, 10209869, 2691591
- GunReload.Parent = GunHandlePart
- local GunChamberBack = IT("Sound")
- GunChamberBack.Looped = false
- GunChamberBack.Volume = 1
- GunChamberBack.Pitch = 1.3
- GunChamberBack.SoundId = "rbxassetid://363762296" --299287260 short version, 268377170 longer version
- GunChamberBack.Parent = GunHandlePart
- local GunChamberForward = IT("Sound")
- GunChamberForward.Looped = false
- GunChamberForward.Volume = 1
- GunChamberForward.Pitch = 1.3
- GunChamberForward.SoundId = "rbxassetid://364490777"
- GunChamberForward.Parent = GunHandlePart
- local GunSmoke = IT("ParticleEmitter")
- GunSmoke.Enabled = false
- GunSmoke.Texture = "rbxassetid://528256032"
- GunSmoke.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.1, 0.05
- ),
- NUMSEQKEYP(
- 1, 0.1, 0.05
- )
- }
- )
- GunSmoke.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.9, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- GunSmoke.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(255 / 255, 255 / 255, 255 / 255)
- ),
- COLORSEQKEYP(
- 1, C3(255 / 255, 255 / 255, 255 / 255)
- )
- }
- )
- GunSmoke.VelocitySpread = 360
- GunSmoke.Lifetime = NUMRANGE(1, 1)
- GunSmoke.Speed = NUMRANGE(0.5, 0.5)
- GunSmoke.Acceleration = VT(0, 2 * 5, 0)
- GunSmoke.Drag = 10
- GunSmoke.VelocityInheritance = 1
- GunSmoke.Rate = 1000
- GunSmoke.LightInfluence = 1
- GunSmoke.LightEmission = 0
- GunSmoke.ZOffset = 0.1
- GunSmoke.EmissionDirection = "Top"
- GunSmoke.Rotation = NUMRANGE(-360, 360)
- GunSmoke.RotSpeed = NUMRANGE(-10, 10)
- GunSmoke.LockedToPart = false
- GunSmoke.Parent = GunHolePart
- local GunShotEffect = IT("ParticleEmitter")
- GunShotEffect.Enabled = false
- GunShotEffect.Texture = "rbxassetid://243728166"
- GunShotEffect.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 1, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- GunShotEffect.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0
- ),
- NUMSEQKEYP(
- 1, 1
- )
- }
- )
- GunShotEffect.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(255 / 255, 170 / 255, 128 / 255)
- ),
- COLORSEQKEYP(
- 1, C3(255 / 255, 170 / 255, 128 / 255)
- )
- }
- )
- GunShotEffect.VelocitySpread = 0
- GunShotEffect.Lifetime = NUMRANGE(0.06, 0.06)
- GunShotEffect.Speed = NUMRANGE(0, 0)
- GunShotEffect.Acceleration = VT(0, 0, 0)
- GunShotEffect.Drag = 0
- GunShotEffect.VelocityInheritance = 0
- GunShotEffect.Rate = 0
- GunShotEffect.LightInfluence = 0
- GunShotEffect.LightEmission = 1
- GunShotEffect.ZOffset = 0.1
- GunShotEffect.EmissionDirection = "Top"
- GunShotEffect.Rotation = NUMRANGE(-360, 360)
- GunShotEffect.RotSpeed = NUMRANGE(0, 0)
- GunShotEffect.LockedToPart = true
- GunShotEffect.Parent = GunHolePart
- local GunLight = IT("PointLight")
- GunLight.Enabled = true
- GunLight.Brightness = 1000
- GunLight.Color = C3(255 / 255, 170 / 255, 128 / 255)
- GunLight.Shadows = true
- GunLight.Range = 0
- GunLight.Parent = GunHolePart
- local FakeRightShoulder = IT("Weld")
- FakeRightShoulder.Name = "Right Shoulder"
- FakeRightShoulder.Part0 = Torso
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeRightShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeRightShoulder.Part1 = RightArm
- local FakeLeftShoulder = IT("Weld")
- FakeLeftShoulder.Name = "Right Shoulder"
- FakeLeftShoulder.Part0 = Torso
- FakeLeftShoulder.C0 = CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeLeftShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
- FakeLeftShoulder.Part1 = LeftArm
- WeaponFolder.Parent = Character
- local function Clerp(INSTANCE, COORDINATE, TIME)
- return INSTANCE:lerp(COORDINATE, TIME)
- end
- local function RenderWait(TIME)
- if TIME == nil or TIME == 0 then
- game:GetService("RunService").Heartbeat:wait()
- else
- for i = 1, TIME do
- game:GetService("RunService").Heartbeat:wait()
- end
- end
- end
- local function EquipState(CURRENTSTATE)
- GUNSTANCE = true
- if CURRENTSTATE == true then
- RightShoulder.Parent = nil
- LeftShoulder.Parent = nil
- FakeRightShoulder.Parent = Torso
- FakeLeftShoulder.Parent = Torso
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(50 + 10 * i), RAD(0), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
- end
- GUNHANDLEOFFSET = RightArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
- GunHandleMotor.Part0 = RightArm
- GunHandleMotor.C0 = GUNHANDLEOFFSET
- Spawn(function()
- RenderWait()
- GunUnholster:Play()
- end)
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45 + 90 * i), RAD(0), RAD(45)) * ANGLES(RAD(0), RAD(-35 - 10 * i), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(35 + 10 * i), RAD(0), RAD(-35 - 10 * i)) * ANGLES(RAD(0), RAD(35 + 10 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
- end
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.8) * ANGLES(RAD(110 - 20 * i), RAD(0), RAD(0 - 30 * i)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.8) * ANGLES(RAD(80 + 10 * i), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30))
- FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
- GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
- else
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(45 - 90 * i), RAD(0), RAD(45)) * ANGLES(RAD(0), RAD(-35 - 10 * i), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(45 - 10 * i), RAD(0), RAD(-45 + 10 * i)) * ANGLES(RAD(0), RAD(45 - 10 * i), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunHolster:Play()
- end)
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(50 + 10 * i), RAD(0), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, GUNHANDLEOFFSET, i)
- end
- GUNHANDLEOFFSET = Torso.CFrame:toObjectSpace(GunHandlePart.CFrame)
- GunHandleMotor.Part0 = Torso
- GunHandleMotor.C0 = GUNHANDLEOFFSET
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(1 - 1 * i), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(1, 0.4, 0.7) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0)), i)
- end
- FakeRightShoulder.Parent = nil
- FakeLeftShoulder.Parent = nil
- RightShoulder.Parent = Torso
- LeftShoulder.Parent = Torso
- GunHandleMotor.C0 = CF(1, 0.4, 0.7) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0))
- end
- GUNSTANCE = false
- end
- local function BulletHole(POSITION, EFFECTCOLOR)
- local BulletHolePart = IT("Part")
- BulletHolePart.Anchored = true
- BulletHolePart.FormFactor = "Custom"
- BulletHolePart.TopSurface, BulletHolePart.BottomSurface, BulletHolePart.RightSurface, BulletHolePart.LeftSurface, BulletHolePart.FrontSurface, BulletHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- BulletHolePart.Name = "Bullet Hole"
- BulletHolePart.Material = "Plastic"
- BulletHolePart.Reflectance = 0
- BulletHolePart.Transparency = 1
- BulletHolePart.CanCollide = false
- BulletHolePart.Locked = true
- BulletHolePart.BrickColor = BRICKC("Medium stone grey")
- BulletHolePart.Size = VT(0.2, 0, 0.2)
- BulletHolePart:BreakJoints()
- BulletHolePart.CFrame = POSITION
- BulletHolePart.Parent = EffectsFolder
- local BulletHoleDecal = IT("Decal")
- BulletHoleDecal.Color3 = C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
- BulletHoleDecal.Face = "Top"
- BulletHoleDecal.Texture = "rbxassetid://359667865"
- BulletHoleDecal.Transparency = 0
- BulletHoleDecal.Parent = BulletHolePart
- local BulletHoleSound = IT("Sound")
- BulletHoleSound.Looped = false
- BulletHoleSound.Volume = 1
- BulletHoleSound.Pitch = MRANDOM(80, 120) / 100
- BulletHoleSound.SoundId = "rbxassetid://"..BulletImpactSounds[13]
- BulletHoleSound.Parent = BulletHolePart
- local BulletHoleSound2 = IT("Sound")
- BulletHoleSound2.Looped = false
- BulletHoleSound2.Volume = 1
- BulletHoleSound2.Pitch = MRANDOM(80, 120) / 100
- BulletHoleSound2.SoundId = "rbxassetid://196864064"
- BulletHoleSound2.Parent = BulletHolePart
- local BulletImpactEffect = IT("ParticleEmitter")
- BulletImpactEffect.Enabled = false
- BulletImpactEffect.Texture = "rbxassetid://241685484"
- BulletImpactEffect.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.05, 0.025
- ),
- NUMSEQKEYP(
- 1, 0.05, 0.025
- )
- }
- )
- BulletImpactEffect.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- BulletImpactEffect.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
- ),
- COLORSEQKEYP(
- 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
- )
- }
- )
- BulletImpactEffect.VelocitySpread = 45
- BulletImpactEffect.Lifetime = NUMRANGE(0.2, 0.2)
- BulletImpactEffect.Speed = NUMRANGE(30, 30)
- BulletImpactEffect.Acceleration = VT(0, -196.2, 0)
- BulletImpactEffect.Drag = 0
- BulletImpactEffect.VelocityInheritance = 0
- BulletImpactEffect.Rate = 0
- BulletImpactEffect.LightInfluence = 1
- BulletImpactEffect.LightEmission = 0
- BulletImpactEffect.ZOffset = 0
- BulletImpactEffect.EmissionDirection = "Top"
- BulletImpactEffect.Rotation = NUMRANGE(-360, 360)
- BulletImpactEffect.RotSpeed = NUMRANGE(-360, 360)
- BulletImpactEffect.LockedToPart = false
- BulletImpactEffect.Parent = BulletHolePart
- local BulletImpactEffect2 = IT("ParticleEmitter")
- BulletImpactEffect2.Enabled = false
- BulletImpactEffect2.Texture = "rbxassetid://709137722"
- BulletImpactEffect2.Size = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0.5, 0
- ),
- NUMSEQKEYP(
- 1, 0.5, 0
- )
- }
- )
- BulletImpactEffect2.Transparency = NUMSEQ(
- {
- NUMSEQKEYP(
- 0, 0, 0
- ),
- NUMSEQKEYP(
- 1, 1, 0
- )
- }
- )
- BulletImpactEffect2.Color = COLORSEQ(
- {
- COLORSEQKEYP(
- 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
- ),
- COLORSEQKEYP(
- 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
- )
- }
- )
- BulletImpactEffect2.VelocitySpread = 10
- BulletImpactEffect2.Lifetime = NUMRANGE(0.2, 0.2)
- BulletImpactEffect2.Speed = NUMRANGE(2, 2)
- BulletImpactEffect2.Acceleration = VT(0, 0, 0)
- BulletImpactEffect2.Drag = 0
- BulletImpactEffect2.VelocityInheritance = 0
- BulletImpactEffect2.Rate = 0
- BulletImpactEffect2.LightInfluence = 1
- BulletImpactEffect2.LightEmission = 0
- BulletImpactEffect2.ZOffset = 0.4
- BulletImpactEffect2.EmissionDirection = "Top"
- BulletImpactEffect2.Rotation = NUMRANGE(-360, 360)
- BulletImpactEffect2.RotSpeed = NUMRANGE(-360, 360)
- BulletImpactEffect2.LockedToPart = false
- BulletImpactEffect2.Parent = BulletHolePart
- Spawn(function()
- RenderWait()
- BulletImpactEffect:Emit(MRANDOM(5, 15))
- BulletImpactEffect2:Emit(MRANDOM(1, 1))
- BulletHoleSound:Play()
- BulletHoleSound2:Play()
- end)
- end
- local function FakeBullet(POSITION, VELOCITY)
- local FakeBulletPart = IT("Part")
- FakeBulletPart.Anchored = false
- FakeBulletPart.FormFactor = "Custom"
- FakeBulletPart.TopSurface, FakeBulletPart.BottomSurface, FakeBulletPart.RightSurface, FakeBulletPart.LeftSurface, FakeBulletPart.FrontSurface, FakeBulletPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- FakeBulletPart.Name = "Bullet Shell"
- FakeBulletPart.Material = "Plastic"
- FakeBulletPart.Reflectance = 0
- FakeBulletPart.Transparency = 0
- FakeBulletPart.CanCollide = true
- FakeBulletPart.Locked = true
- FakeBulletPart.BrickColor = BRICKC("Bright yellow")
- FakeBulletPart.Size = VT(0.32, 0.12, 0.12)
- FakeBulletPart:BreakJoints()
- FakeBulletPart.CFrame = POSITION
- local FakeBulletMesh = IT("SpecialMesh")
- FakeBulletMesh.MeshType = "Cylinder"
- FakeBulletMesh.MeshId = ""
- FakeBulletMesh.TextureId = ""
- FakeBulletMesh.Offset = VT(0, 0, 0)
- FakeBulletMesh.Scale = VT(1, 1, 1)
- FakeBulletMesh.Parent = FakeBulletPart
- FakeBulletPart.Parent = EffectsFolder
- FakeBulletPart.Velocity = VELOCITY
- game:GetService("Debris"):AddItem(FakeBulletPart, 3)
- --[[
- local BulletContact = IT("Sound")
- BulletContact.Looped = false
- BulletContact.Volume = 0.5
- BulletContact.Pitch = 1
- BulletContact.SoundId = "rbxassetid://"..BulletShellImpactSounds[5]
- BulletContact.Parent = FakeBulletPart
- local HITSOMETHING = false
- FakeBulletPart.Touched:connect(function()
- if HITSOMETHING == false then
- HITSOMETHING = true
- Spawn(function()
- RenderWait()
- BulletContact:Play()
- end)
- end
- end)
- --]]
- end
- local function FakeClip(POSITION, VELOCITY)
- local FakeClipPart = IT("Part")
- FakeClipPart.Anchored = false
- FakeClipPart.FormFactor = "Custom"
- FakeClipPart.TopSurface, FakeClipPart.BottomSurface, FakeClipPart.RightSurface, FakeClipPart.LeftSurface, FakeClipPart.FrontSurface, FakeClipPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
- FakeClipPart.Name = "Clip"
- FakeClipPart.Material = "Plastic"
- FakeClipPart.Reflectance = 0
- FakeClipPart.Transparency = 0
- FakeClipPart.CanCollide = true
- FakeClipPart.Locked = true
- FakeClipPart.BrickColor = BRICKC("Black")
- FakeClipPart.Size = VT(0.3, 0.3, 0.5)
- FakeClipPart:BreakJoints()
- FakeClipPart.CFrame = POSITION
- FakeClipPart.Parent = EffectsFolder
- FakeClipPart.Velocity = VELOCITY
- game:GetService("Debris"):AddItem(FakeClipPart, 3)
- end
- local function ShootGun()
- GUNSTANCE = true
- local HITHUMANOID = nil
- spawn(function()
- RenderWait()
- GunShot.Pitch = MRANDOM(90, 110) / 100
- GunShot:Play()
- end)
- GunShotEffect:Emit(MRANDOM(4, 6))
- GunLight.Range = 8
- BULLETCOUNT = BULLETCOUNT - 1
- for i = 1, 1 do
- local GUNSPREAD = VT(MRANDOM(-0, 0) / 100, MRANDOM(-0, 0) / 100, MRANDOM(-0, 0) / 100) * ((GunHolePart.Position - Mouse.Hit.p).magnitude / 100)
- local GUNRAY = Ray.new(GunHolePart.Position, (CF(GunHolePart.Position, Mouse.Hit.p + GUNSPREAD).lookVector).unit * 1000)
- local GUNRAYHIT, GUNRAYPOSITION, GUNRAYANGLE = game:GetService("Workspace"):FindPartOnRay(GUNRAY, Character)
- if GUNRAYHIT ~= nil then
- if GUNRAYHIT.Parent:FindFirstChild("Humanoid") then
- HITHUMANOID = GUNRAYHIT.Parent:FindFirstChild("Humanoid")
- else
- if GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid") then
- HITHUMANOID = GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid")
- end
- end
- if HITHUMANOID ~= nil and HITHUMANOID.Parent ~= Character then
- if GUNRAYHIT.Name == "Head" or GUNRAYHIT.ClassName == "Accessory" then
- HITHUMANOID.Health = 0
- else
- HITHUMANOID.Health = HITHUMANOID.Health - (HITHUMANOID.MaxHealth * (math.random(7,10)/10))
- end
- else
- BulletHole(CF(GUNRAYPOSITION, GUNRAYPOSITION - GUNRAYANGLE) * ANGLES(RAD(90), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(MRANDOM(-360, 360)), RAD(0)), GUNRAYHIT.BrickColor)
- end
- end
- end
- SMOKETIME = 2
- for i = 0, 1, 0.1 do
- RenderWait()
- GunLight.Range = 8 - (8 * i)
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 1) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.3) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- GunLight.Range = 0
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(20 - 20 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(20 - 20 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- local FAKEGUNHANDLEOFFSET = LeftArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
- GunHandleMotor.Part0 = LeftArm
- GunHandleMotor.C0 = FAKEGUNHANDLEOFFSET
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- end
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(110 + 10 * i), RAD(0), RAD(-5)) * ANGLES(RAD(0), RAD(70 + 10 * i), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunChamberBack:Play()
- end)
- FakeBullet(GunHandlePart.CFrame * CF(0, 0.7, 0.1) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20))), (GunHandlePart.CFrame * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(30), RAD(0), RAD(0))).lookVector * 20)
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 1.1 + 0.1 * i) * ANGLES(RAD(120), RAD(0), RAD(-5)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.4) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunChamberForward:Play()
- end)
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.9 - 0.1 * i) * ANGLES(RAD(120), RAD(0), RAD(-5)) * ANGLES(RAD(0), RAD(70), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- end
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-20 - 10 * i)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- end
- FAKEGUNHANDLEOFFSET = RightArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
- GunHandleMotor.Part0 = RightArm
- GunHandleMotor.C0 = FAKEGUNHANDLEOFFSET
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30))
- FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
- GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
- GUNSTANCE = false
- end
- local function ReloadGun()
- GUNSTANCE = true
- if BULLETCOUNT <= 0 then
- CHAMBEREMPTY = true
- end
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.1 - 0.1 * i) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(0 + 10 * i), RAD(0), RAD(0)) * CF(-0.2, 0.5, -1) * ANGLES(RAD(90), RAD(0), RAD(45)) * ANGLES(RAD(15), RAD(0 - 10 * i), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunReload.Pitch = 0.6
- GunReload:Play()
- end)
- FakeClip(GunHandlePart.CFrame * CF(0.05, 0.4, -0.7) * ANGLES(RAD(0), RAD(0), RAD(0)), (GunHandlePart.CFrame * ANGLES(RAD(-90), RAD(0), RAD(0))).lookVector * 10)
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunReload.Pitch = 0.9
- GunReload:Play()
- end)
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.1 - 0.1 * i) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(0 + 10 * i), RAD(0), RAD(0)) * CF(-0.2, 0.5, -1) * ANGLES(RAD(90), RAD(0), RAD(45)) * ANGLES(RAD(15), RAD(0 - 10 * i), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- for i = 0, 1, 0.05 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.7 + 0.1 * i) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- if BULLETCOUNT > 0 then
- GunReload:Stop()
- end
- if CHAMBEREMPTY == true then
- CHAMBEREMPTY = false
- local FAKEGUNHANDLEOFFSET = LeftArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
- GunHandleMotor.Part0 = LeftArm
- GunHandleMotor.C0 = FAKEGUNHANDLEOFFSET
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- end
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(110 + 10 * i), RAD(0), RAD(-5)) * ANGLES(RAD(0), RAD(70 + 10 * i), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunChamberBack:Play()
- end)
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 1.1 + 0.1 * i) * ANGLES(RAD(120), RAD(0), RAD(-5)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.4) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- end
- Spawn(function()
- RenderWait()
- GunChamberForward:Play()
- end)
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.9 - 0.1 * i) * ANGLES(RAD(120), RAD(0), RAD(-5)) * ANGLES(RAD(0), RAD(80), RAD(0)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- end
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-20 - 10 * i)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- end
- FAKEGUNHANDLEOFFSET = RightArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
- GunHandleMotor.Part0 = RightArm
- GunHandleMotor.C0 = FAKEGUNHANDLEOFFSET
- for i = 0, 1, 0.1 do
- RenderWait()
- FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
- FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
- GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
- end
- end
- FakeRightShoulder.C0 = CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30))
- FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
- GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
- BULLETCOUNT = MAXBULLETS
- GUNSTANCE = false
- end
- --//=================================\\
- --|| SET THINGS UP
- --\\=================================//
- Mouse.Button1Down:connect(function()
- if GUNSTANCE == false and EQUIPPED == true then
- if BULLETCOUNT > 0 then
- ShootGun()
- elseif BULLETCOUNT <= 0 then
- ReloadGun()
- end
- end
- end)
- Mouse.KeyDown:connect(function(KEY)
- if KEY == "y" and GUNSTANCE == false then
- if EQUIPPED == false then
- EQUIPPED = true
- else
- EQUIPPED = false
- end
- EquipState(EQUIPPED)
- end
- if KEY == "r" and GUNSTANCE == false and EQUIPPED == true then
- ReloadGun()
- end
- end)
- --//=================================\\
- --|| WRAP THE WHOLE SCRIPT UP
- --\\=================================//
- while true do
- RenderWait()
- SMOKETIME = SMOKETIME - (1 / 30) / 2
- if SMOKETIME <= 0 then
- if GunSmoke.Enabled == true then
- GunSmoke.Enabled = false
- end
- else
- if GunSmoke.Enabled == false then
- GunSmoke.Enabled = true
- end
- end
- end
- --//====================================================\\--
- --|| END OF SCRIPT
- --\\====================================================//--
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement