Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wait(.5)
- local event = Instance.new("RemoteEvent")
- local localscript = NLS([[local p = game:GetService("Players").LocalPlayer
- local c = p.Character
- local cam = workspace.CurrentCamera
- local rp = c:WaitForChild("HumanoidRootPart")
- local humanoid = c:WaitForChild("Humanoid")
- local event = script:WaitForChild("RemoteEvent")
- local rs = game:GetService("RunService").RenderStepped
- local m = p:GetMouse()
- wait(1)
- for i,v in next,humanoid:GetPlayingAnimationTracks() do
- v:Stop()
- end
- humanoid.WalkSpeed = 23
- local uip = game:GetService("UserInputService")
- uip.InputBegan:connect(function(a,b)
- if not b then
- if a.UserInputType == Enum.UserInputType.MouseButton1 then
- event:FireServer("mouse",true)
- end
- if a.KeyCode == Enum.KeyCode.R then
- event:FireServer("switch")
- end
- if a.KeyCode == Enum.KeyCode.F then
- event:FireServer("hostile")
- end
- end
- end)
- uip.InputEnded:connect(function(a,b)
- if not b then
- if a.UserInputType == Enum.UserInputType.MouseButton1 then
- event:FireServer("mouse",false)
- end
- end
- end)
- event.OnClientEvent:connect(function(t,a)
- if t == "velocityforward" then
- end
- end)
- local bodygyro = Instance.new("BodyGyro",rp)
- local state = "idle"
- local ostate = "idle"
- rs:connect(function()
- --local x,y,z = cam.CFrame:ToEulerAnglesXYZ()
- --bodygyro.MaxTorque = Vector3.new(0,999999,0)
- --bodygyro.CFrame = cam.CFrame
- if state ~= ostate then
- event:FireServer("state",state)
- ostate = state
- end
- local vel = rp.Velocity.magnitude
- if vel<.1 then
- state = "idle"
- else
- state = "walk"
- end
- end)
- while wait(1/40) do
- event:FireServer("aimpos",m.Hit)
- end]],owner.Character)
- event.Parent = localscript
- local gamestep = Instance.new("BindableEvent",script)
- gamestep.Name = "gamestep"
- local rs = game:GetService("RunService").Heartbeat
- framenum = 1/60
- cuframe = 0
- rs:connect(function(s,p)
- cuframe = cuframe + s
- if cuframe > framenum then
- for i = 1,math.floor(cuframe/framenum) do
- gamestep:Fire()
- end
- cuframe = cuframe-framenum*math.floor(cuframe/framenum)
- end
- end)
- local p = game:GetService("Players"):WaitForChild("asbuff")
- repeat wait() until p.Character
- local c = p.Character
- local rarm = c["Right Arm"]
- local rp = c:WaitForChild("HumanoidRootPart")
- local humanoid = c:WaitForChild("Humanoid")
- local torso = c:WaitForChild("Torso")
- local animation = {}
- do
- function animation.new(rig)
- local self = {}
- self.joints = {}
- self.cframes = {}
- self.origcframes = {}
- self.ucframes = {}
- self.weight = .2
- self.stopanimfunc = nil
- for i,v in next,rig:GetChildren() do
- for i,joint in next,v:GetChildren() do
- if joint:IsA("Motor6D") then
- self.joints[joint.Part1.Name] = joint
- end
- end
- end
- for i,v in next,self.joints do
- --print(i)
- end
- function self:stop()
- self.stopanimfunc()
- end
- self.currentanim = ""
- function self:play(name,anim,loop,speed,weight,interupt,lop,func)
- if self.currentanim == name and lop == true then
- --print("fooeds")
- return
- end
- local anim = anim
- local starttime = tick()
- local stop = false
- local pause =false
- self.weight = weight
- if interupt == true then
- if self.stopanimfunc ~= nil then
- self.stopanimfunc()
- end
- else
- end
- self.currentanim = name
- self.stopanimfunc = function()
- pause = true
- end
- local timer = 0
- local function leadstep()
- local kf = 0
- local smallesttime = 999
- local found = false
- local dtime = tick()-starttime
- timer = timer + (1/60)*speed
- dtime = timer
- for i,v in next,anim do
- local ntime = 0
- if anim[i+1] then
- if anim[i+1].time then
- ntime = anim[i+1].time
- end
- else
- ntime = v.time
- end
- if v.time < smallesttime and ntime > dtime then
- smallesttime = v.time
- kf = i
- found = true
- end
- end
- if found == false then
- if loop then
- starttime = tick()
- timer = 0
- else
- stop = true
- end
- end
- if pause == true then
- stop = true
- end
- local keyframe = anim[kf]
- for name,v in next,self.joints do
- local sine = false
- local cf = CFrame.new()
- local found = false
- if keyframe then
- for i,a in next,keyframe do
- if i == name then
- if type(a) == "table" then
- local yes = a[2]()
- cf = a[1]*yes
- found = true
- else
- cf = a
- found = true
- end
- end
- end
- end
- if found == true then
- self.cframes[name] = cf
- end
- end
- end
- local upd
- upd = rs:connect(function()
- leadstep()
- if stop == true then
- --print("stop")
- for i,v in next,self.cframes do
- --self.cframes[i]=CFrame.new()
- end
- func()
- upd:disconnect()
- end
- end)
- return function() stop = true end
- end
- function self:step()
- for i,v in next,self.joints do
- if self.cframes[i] then
- if self.ucframes[i] == nil then self.ucframes[i] = CFrame.new() end
- self.ucframes[i] = self.ucframes[i]:lerp(self.cframes[i],self.weight)
- if self.origcframes[i] == nil then self.origcframes[i] = v.C0 end
- v.C0 = self.origcframes[i] * self.ucframes[i]
- end
- end
- end
- return self
- end
- end
- local gun = Instance.new("Part")
- gun.Size = Vector3.new(1, 1, 1)
- gun.CanCollide = false
- local mesh = Instance.new("SpecialMesh",gun)
- mesh.MeshId = "rbxassetid://499544111"
- mesh.TextureId = "rbxassetid://499544129"
- mesh.Scale = Vector3.new(0.004, 0.004, 0.004)
- local gweld = Instance.new("Motor6D",rarm)
- gweld.Part0 = rarm
- gweld.Part1 = gun
- gun.Parent = c
- local muzzle = Instance.new("Part")
- muzzle.Size = Vector3.new(.2,.2,.2)
- muzzle.CanCollide = false
- local mweld = Instance.new("Weld",gun)
- mweld.Part0 = gun
- mweld.Part1 = muzzle
- mweld.C0 = CFrame.new(0.9,.4,0)
- muzzle.Parent = gun
- local maincol = Color3.fromRGB(128, 187, 219)
- ---
- local mf1 = Instance.new("ParticleEmitter")
- mf1.LightEmission = 1
- mf1.Size = NumberSequence.new({
- NumberSequenceKeypoint.new(0,1),
- NumberSequenceKeypoint.new(1,2.35),
- })
- mf1.Texture = "rbxassetid://1847258023"
- mf1.Transparency = NumberSequence.new({
- NumberSequenceKeypoint.new(0,1),
- NumberSequenceKeypoint.new(0.6,0),
- NumberSequenceKeypoint.new(1,1),
- })
- mf1.LockedToPart = true
- mf1.Lifetime = NumberRange.new(.2)
- mf1.Rate = 30
- mf1.Rotation = NumberRange.new(0,360)
- mf1.Enabled = false
- mf1.Speed = NumberRange.new(0)
- mf1.Parent = muzzle
- ---
- local mf2 = Instance.new("ParticleEmitter")
- mf2.LightEmission = 1
- mf2.Size = NumberSequence.new({
- NumberSequenceKeypoint.new(0,0),
- NumberSequenceKeypoint.new(0.5,0.1),
- NumberSequenceKeypoint.new(1,0),
- })
- mf2.Texture = "rbxassetid://156486182"
- mf2.Transparency = NumberSequence.new({
- NumberSequenceKeypoint.new(0,1),
- NumberSequenceKeypoint.new(0.6,0.7),
- NumberSequenceKeypoint.new(1,1),
- })
- mf2.LockedToPart = true
- mf2.Lifetime = NumberRange.new(.2)
- mf2.Rate = 30
- mf2.Rotation = NumberRange.new(0,360)
- mf2.Enabled = false
- mf2.Speed = NumberRange.new(10,20)
- mf2.SpreadAngle = Vector2.new(180,180)
- mf2.Parent = muzzle
- mf2.EmissionDirection = "Front"
- mf2.Drag = 20
- local mf3 = Instance.new("ParticleEmitter")
- mf3.LightEmission = 1
- mf3.Size = NumberSequence.new({
- NumberSequenceKeypoint.new(0,1),
- NumberSequenceKeypoint.new(1,1.85),
- })
- mf3.Texture = "http://www.roblox.com/asset/?id=233113663"
- mf3.Transparency = NumberSequence.new({
- NumberSequenceKeypoint.new(0,1),
- NumberSequenceKeypoint.new(0.6,0),
- NumberSequenceKeypoint.new(1,1),
- })
- mf3.LockedToPart = true
- mf3.Lifetime = NumberRange.new(.04)
- mf3.Rate = 30
- mf3.Rotation = NumberRange.new(0,360)
- mf3.Enabled = false
- mf3.Speed = NumberRange.new(0)
- mf3.Parent = muzzle
- ---
- mf2.Color = ColorSequence.new(maincol)
- mf3.Color = ColorSequence.new(maincol)
- mf1.Color = ColorSequence.new(maincol)
- --
- local whir = Instance.new("Sound",gun)
- whir.SoundId = "rbxassetid://394182767"
- whir.PlaybackSpeed = 1.4
- whir.Volume = 1
- local laser = Instance.new("Sound",gun)
- laser.SoundId = "rbxassetid://1898322396"
- laser.PlaybackSpeed = 1
- laser.Volume = 1
- local laser2 = Instance.new("Sound",gun)
- laser2.SoundId = "rbxassetid://1202656211"
- laser2.PlaybackSpeed = 1
- laser2.Volume = 1
- --
- local rig = animation.new(c)
- local funcs = {}
- local pointcf = CFrame.new()
- function lookat(start,target)
- local distance = (start.p-target.p).magnitude
- local offset = start:toObjectSpace(target)
- local x = math.atan2(offset.x,-offset.z)
- local offset = (start * CFrame.Angles(0,-x,0)):toObjectSpace(target)
- local y = math.atan2(offset.y,-offset.z)
- return CFrame.Angles(0,-x,0)*CFrame.Angles(0,0,y+math.pi/2)--x,y,distance
- end
- function lookat2(start,target)
- local distance = (start.p-target.p).magnitude
- local offset = start:toObjectSpace(target)
- local x = math.atan2(offset.x,-offset.z)
- local offset = (start * CFrame.Angles(0,-x,0)):toObjectSpace(target)
- local y = math.atan2(offset.y,-offset.z)
- return CFrame.Angles(0,0,-x)*CFrame.Angles(-y,0,0)
- end
- local recoil = CFrame.new()
- local anims = {
- idle= {
- {
- ["Left Leg"] = {CFrame.new(-0.276043445, 0.201377928, 0, 0.988015771, -0.154352978, 0, 0.154352978, 0.988015771, 0, 0, 0, 1),function() return CFrame.new(0,-math.sin(tick())/9,0) end},
- ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0) end},
- ["Right Arm"] = CFrame.new(0.110922299, -0.061678648, 0.0636402369, 0.901174605, -0.162362188, -0.40189901, 0.259175479, 0.945029497, 0.199366987, 0.347436816, -0.283826828, 0.893716872),
- ["Left Arm"] = CFrame.new(0, 2.98023224e-08, 0, 1, 0, 0, 0, 0.996509433, 0.0834799111, 0, -0.0834799111, 0.996509433),
- ["Part"] = CFrame.new(-0.233995408, -0.73597014, -0.575105429, 0.0200314447, -0.523180068, 0.851986706, -0.904473543, 0.353659719, 0.238437548, -0.426059067, -0.775375664, -0.466118187),
- ["Torso"] = {CFrame.new(0, -0.169919834, -0.163296893, 1, 0, 0, 0, 0.992978275, -0.11829678, 0, 0.11829678, 0.992978275)*CFrame.new(0,0,-.15),function() return CFrame.new(0,0,math.sin(tick())/9) end},
- ["Right Leg"] = {CFrame.new(0.212829798, 0.0396305323, 0, 0.961647749, -0.274287581, 0, 0.274287581, 0.961647749, 0, 0, 0, 1),function() return CFrame.new(0,-math.sin(tick())/9,0) end},
- ["time"] = 0.1,
- },
- },
- walk= {
- {
- ["Left Leg"] = CFrame.new(-0.832244754, 0.735471427, 0, 0.943914652, 0.330189466, 0, -0.330189466, 0.943914652, 0, 0, 0, 1),
- ["Head"] = CFrame.new(4.65661287e-10, -1.3038516e-08, 0, 0.996589422, -0.0825192854, 0, 0.0823644698, 0.994719744, 0.0612255484, -0.00505228853, -0.061016731, 0.998123944),
- ["Right Arm"] = CFrame.new(0.110922113, -0.0616788566, 0.0636404157, 0.80436188, -0.437583208, -0.40189901, 0.543276906, 0.815538406, 0.199366987, 0.240524471, -0.378705651, 0.893716872),
- ["Left Arm"] = CFrame.new(2.98023224e-08, 5.96046448e-08, 0, 0.856122494, -0.516772985, 0, 0.51496917, 0.853134155, 0.0834799111, -0.0431401618, -0.0714690313, 0.996509433),
- ["Part"] = CFrame.new(-0.233995453, -0.73597002, -0.57510525, 0.0200314447, -0.523180068, 0.851986706, -0.904473543, 0.353659719, 0.238437548, -0.426059067, -0.775375664, -0.466118187),
- ["Torso"] = CFrame.new(1.86264515e-09, -0.169919834, -0.163296893, 0.992377043, 0.12323869, 0, -0.122373343, 0.985408843, -0.11829678, -0.014578741, 0.117395014, 0.992978275),
- ["Right Leg"] = CFrame.new(0, 0, 0, 0.775688052, 0.631116509, 0, -0.631116509, 0.775688052, 0, 0, 0, 1),
- ["time"] = 0,
- },
- {
- ["Left Leg"] = CFrame.new(-0.626752317, 0.152361274, 0, 0.904599249, 0.426262915, 0, -0.426262915, 0.904599249, 0, 0, 0, 1),
- ["Right Arm"] = CFrame.new(0.110922113, -0.0616788566, 0.0636404157, 0.80436188, -0.437583208, -0.40189901, 0.543276906, 0.815538406, 0.199366987, 0.240524471, -0.378705651, 0.893716872),
- ["time"] = 0.10000000149012,
- },
- {
- ["Right Leg"] = CFrame.new(0.935470343, -0.145744145, 0, 0.573149741, 0.819450617, 0, -0.819450617, 0.573149741, 0, 0, 0, 1),
- ["Torso"] = CFrame.new(0, -0.275256932, -0.260381281, 1, 0, 0, 0, 0.986370206, -0.164541662, 0, 0.164541662, 0.986370206),
- ["time"] = 0.25,
- ["Right Arm"] = CFrame.new(-0.189867541, -0.0872892439, -0.0630964339, 0.918714464, 0.00577605516, -0.394880086, 0.0782234967, 0.977420926, 0.196289182, 0.387097806, -0.211222619, 0.897518933),
- },
- {
- ["time"] = 0.34999999403954,
- ["Left Arm"] = CFrame.new(-1.1920929e-07, -8.94069672e-08, 1.78813934e-07, 0.762209237, 0.632005513, -0.140021756, -0.593523026, 0.768650293, 0.238552079, 0.258393973, -0.0987204164, 0.960982203),
- },
- {
- ["Left Leg"] = CFrame.new(-0.0431639552, -0.168072104, 0, 0.666396379, -0.745597661, 0, 0.745597661, 0.666396379, 0, 0, 0, 1),
- ["Right Arm"] = CFrame.new(0.110922217, -0.0616786182, 0.0636402667, 0.839134037, 0.367455184, -0.401037157, -0.311672837, 0.929087341, 0.19914031, 0.445773691, -0.042113021, 0.894154549),
- ["Head"] = CFrame.new(-3.37604433e-09, -7.4505806e-09, 0, 0.994075179, 0.108695045, -7.43893906e-07, -0.108491212, 0.992211699, 0.0612013899, 0.00665302714, -0.0608386956, 0.998125434),
- ["Torso"] = CFrame.new(0, -0.169919848, -0.163296893, 0.996150553, -0.0876595378, 0, 0.0870440304, 0.989155829, -0.11829678, 0.010369841, 0.1178414, 0.992978275),
- ["Right Leg"] = CFrame.new(0.648889005, 0.775551796, 0, 0.944947481, -0.32722193, 0, 0.32722193, 0.944947481, 0, 0, 0, 1),
- ["time"] = 0.40000000596046,
- },
- {
- ["time"] = 0.5,
- ["Right Arm"] = CFrame.new(0.110922217, -0.0616786182, 0.0636402667, 0.839134037, 0.367455184, -0.401037157, -0.311672837, 0.929087341, 0.19914031, 0.445773691, -0.042113021, 0.894154549),
- ["Left Arm"] = CFrame.new(-0.164686471, 0.0678058863, -0.0345693827, 0.90774864, 0.399867833, -0.126878306, -0.373744369, 0.908207536, 0.188345969, 0.190545335, -0.123550735, 0.973872542),
- },
- {
- ["time"] = 0.55000001192093,
- ["Right Leg"] = CFrame.new(0.327592164, 0.132180274, 0, 0.866657019, -0.498904556, 0, 0.498904556, 0.866657019, 0, 0, 0, 1),
- },
- {
- ["time"] = 0.60000002384186,
- ["Left Leg"] = CFrame.new(-0.843260288, -0.150004089, 0, 0.48957324, -0.87196213, 0, 0.87196213, 0.48957324, 0, 0, 0, 1),
- },
- {
- ["Torso"] = CFrame.new(0, -0.258102387, -0.363217384, 1, 0, 0, 0, 0.986370206, -0.164541662, 0, 0.164541662, 0.986370206),
- ["time"] = 0.64999997615814,
- ["Right Arm"] = CFrame.new(0.380866587, -0.0053589642, 0.170066118, 0.913265884, -0.100147665, -0.394861788, 0.190538883, 0.961758077, 0.196764603, 0.360056013, -0.254934937, 0.89742291),
- },
- {
- ["Left Leg"] = CFrame.new(-0.832244754, 0.735471427, 0, 0.943914652, 0.330189466, 0, -0.330189466, 0.943914652, 0, 0, 0, 1),
- ["Head"] = CFrame.new(4.65661287e-10, -1.3038516e-08, 0, 0.996589422, -0.0825192854, 0, 0.0823644698, 0.994719744, 0.0612255484, -0.00505228853, -0.061016731, 0.998123944),
- ["Right Arm"] = CFrame.new(0.110922113, -0.0616788566, 0.0636404157, 0.80436188, -0.437583208, -0.40189901, 0.543276906, 0.815538406, 0.199366987, 0.240524471, -0.378705651, 0.893716872),
- ["Left Arm"] = CFrame.new(2.98023224e-08, 5.96046448e-08, 0, 0.856122494, -0.516772985, 0, 0.51496917, 0.853134155, 0.0834799111, -0.0431401618, -0.0714690313, 0.996509433),
- ["Part"] = CFrame.new(-0.233995453, -0.73597002, -0.57510525, 0.0200314447, -0.523180068, 0.851986706, -0.904473543, 0.353659719, 0.238437548, -0.426059067, -0.775375664, -0.466118187),
- ["Torso"] = CFrame.new(1.86264515e-09, -0.169919834, -0.163296893, 0.992377043, 0.12323869, 0, -0.122373343, 0.985408843, -0.11829678, -0.014578741, 0.117395014, 0.992978275),
- ["Right Leg"] = CFrame.new(0, 0, 0, 0.775688052, 0.631116509, 0, -0.631116509, 0.775688052, 0, 0, 0, 1),
- ["time"] = 0.80000001192093,
- },
- },
- idleaim= {
- {
- ["Left Leg"] = {CFrame.new(-0.276043445, 0.201377928, 0, 0.988015771, -0.154352978, 0, 0.154352978, 0.988015771, 0, 0, 0, 1),function() return CFrame.new(0,-math.sin(tick())/9,0) end},
- ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
- ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
- ["Left Arm"] = CFrame.new(0, 2.98023224e-08, 0, 1, 0, 0, 0, 0.996509433, 0.0834799111, 0, -0.0834799111, 0.996509433),
- ["Part"] = CFrame.Angles(0,math.pi/2,-math.pi/2)*CFrame.new(1.2,.3,0),
- ["Torso"] = {CFrame.new(0, -0.169919834, -0.163296893, 1, 0, 0, 0, 0.992978275, -0.11829678, 0, 0.11829678, 0.992978275)*CFrame.Angles(math.rad(-2),0,math.rad(20))*CFrame.new(0,0,-.15),function() return CFrame.new(0,0,math.sin(tick())/9) end},
- ["Right Leg"] = {CFrame.new(0.212829798, 0.0396305323, 0, 0.961647749, -0.274287581, 0, 0.274287581, 0.961647749, 0, 0, 0, 1),function() return CFrame.new(0,-math.sin(tick())/9,0) end},
- ["time"] = 0.1,
- },
- },
- walkaim= {
- {
- ["Left Leg"] = CFrame.new(-0.832244754, 0.735471427, 0, 0.943914652, 0.330189466, 0, -0.330189466, 0.943914652, 0, 0, 0, 1),
- ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
- ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
- ["Left Arm"] = CFrame.new(2.98023224e-08, 5.96046448e-08, 0, 0.856122494, -0.516772985, 0, 0.51496917, 0.853134155, 0.0834799111, -0.0431401618, -0.0714690313, 0.996509433),
- ["Part"] = CFrame.Angles(0,math.pi/2,-math.pi/2)*CFrame.new(1.2,.3,0),
- ["Torso"] = CFrame.new(1.86264515e-09, -0.169919834, -0.163296893, 0.992377043, 0.12323869, 0, -0.122373343, 0.985408843, -0.11829678, -0.014578741, 0.117395014, 0.992978275),
- ["Right Leg"] = CFrame.new(0, 0, 0, 0.775688052, 0.631116509, 0, -0.631116509, 0.775688052, 0, 0, 0, 1),
- ["time"] = 0,
- },
- {
- ["Left Leg"] = CFrame.new(-0.626752317, 0.152361274, 0, 0.904599249, 0.426262915, 0, -0.426262915, 0.904599249, 0, 0, 0, 1),
- ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
- ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
- ["time"] = 0.10000000149012,
- },
- {
- ["Right Leg"] = CFrame.new(0.935470343, -0.145744145, 0, 0.573149741, 0.819450617, 0, -0.819450617, 0.573149741, 0, 0, 0, 1),
- ["Torso"] = CFrame.new(0, -0.275256932, -0.260381281, 1, 0, 0, 0, 0.986370206, -0.164541662, 0, 0.164541662, 0.986370206),
- ["time"] = 0.25,
- ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
- ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
- },
- {
- ["time"] = 0.34999999403954,
- ["Left Arm"] = CFrame.new(-1.1920929e-07, -8.94069672e-08, 1.78813934e-07, 0.762209237, 0.632005513, -0.140021756, -0.593523026, 0.768650293, 0.238552079, 0.258393973, -0.0987204164, 0.960982203),
- ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
- ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
- },
- {
- ["Left Leg"] = CFrame.new(-0.0431639552, -0.168072104, 0, 0.666396379, -0.745597661, 0, 0.745597661, 0.666396379, 0, 0, 0, 1),
- ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
- ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
- ["Torso"] = CFrame.new(0, -0.169919848, -0.163296893, 0.996150553, -0.0876595378, 0, 0.0870440304, 0.989155829, -0.11829678, 0.010369841, 0.1178414, 0.992978275),
- ["Right Leg"] = CFrame.new(0.648889005, 0.775551796, 0, 0.944947481, -0.32722193, 0, 0.32722193, 0.944947481, 0, 0, 0, 1),
- ["time"] = 0.40000000596046,
- },
- {
- ["time"] = 0.5,
- ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
- ["Left Arm"] = CFrame.new(-0.164686471, 0.0678058863, -0.0345693827, 0.90774864, 0.399867833, -0.126878306, -0.373744369, 0.908207536, 0.188345969, 0.190545335, -0.123550735, 0.973872542),
- ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
- },
- {
- ["time"] = 0.55000001192093,
- ["Right Leg"] = CFrame.new(0.327592164, 0.132180274, 0, 0.866657019, -0.498904556, 0, 0.498904556, 0.866657019, 0, 0, 0, 1),
- ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
- },
- {
- ["time"] = 0.60000002384186,
- ["Left Leg"] = CFrame.new(-0.843260288, -0.150004089, 0, 0.48957324, -0.87196213, 0, 0.87196213, 0.48957324, 0, 0, 0, 1),
- ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
- ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
- },
- {
- ["Torso"] = CFrame.new(0, -0.258102387, -0.363217384, 1, 0, 0, 0, 0.986370206, -0.164541662, 0, 0.164541662, 0.986370206),
- ["time"] = 0.64999997615814,
- ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
- ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
- },
- {
- ["Left Leg"] = CFrame.new(-0.832244754, 0.735471427, 0, 0.943914652, 0.330189466, 0, -0.330189466, 0.943914652, 0, 0, 0, 1),
- ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
- ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
- ["Left Arm"] = CFrame.new(2.98023224e-08, 5.96046448e-08, 0, 0.856122494, -0.516772985, 0, 0.51496917, 0.853134155, 0.0834799111, -0.0431401618, -0.0714690313, 0.996509433),
- ["Part"] = CFrame.Angles(0,math.pi/2,-math.pi/2)*CFrame.new(1.2,.3,0),
- ["Torso"] = CFrame.new(1.86264515e-09, -0.169919834, -0.163296893, 0.992377043, 0.12323869, 0, -0.122373343, 0.985408843, -0.11829678, -0.014578741, 0.117395014, 0.992978275),
- ["Right Leg"] = CFrame.new(0, 0, 0, 0.775688052, 0.631116509, 0, -0.631116509, 0.775688052, 0, 0, 0, 1),
- ["time"] = 0.80000001192093,
- },
- },
- }
- local mouse = {mouse1=false,hit=CFrame.new()}
- local shoot = {}
- do
- local bullets = {}
- function shoot.bullet(b)
- local self = {}
- local h,p,r
- local ignore = {c}
- local cpos = muzzle.CFrame.p
- local parts = {}
- local reps = 0
- local rotoff = Vector3.new()
- local sound = laser:Clone()
- sound.Parent = muzzle
- sound:Play()
- game.Debris:AddItem(sound,1)
- mf3:Emit(4)
- recoil = CFrame.new(0,0.3,0)
- local id = math.random(2135225,435223464)
- --bullets[id]=self
- --function self:step()
- rotoff = rotoff + Vector3.new(0,-.003,0)
- reps = reps + 1
- h,p,r = workspace:FindPartOnRayWithIgnoreList(Ray.new(
- cpos,
- ((CFrame.new(muzzle.CFrame.p,b.p).lookVector)+(rotoff))*999
- ),ignore)
- --laser
- local dist = (cpos-p).magnitude
- local laser = Instance.new("Part")
- laser.Color = maincol
- laser.Material = "Neon"
- laser.Size = Vector3.new(.4,.4,dist)
- laser.CFrame = CFrame.new(cpos,p)*CFrame.new(0,0,-dist/2)
- laser.Anchored = true
- laser.CanCollide = false
- laser.Parent = c
- game.Debris:AddItem(laser,.02)
- if h then
- end
- cpos = p
- --rs:wait()
- if reps > 100 then
- --bullets[id]=nil
- end
- if h ~= nil then
- if h.Parent:FindFirstChildOfClass("Humanoid") then
- local hum = h.Parent:FindFirstChildOfClass("Humanoid")
- hum.Health = 0
- h:BreakJoints()
- end
- --bullets[id]=nil
- --[[delay(0,function()
- local explosion = Instance.new("Explosion")
- explosion.Visible =false
- explosion.BlastRadius = 1
- explosion.BlastPressure = 0
- explosion.Position = p
- explosion.Parent = workspace
- local lol = explosion.Hit:connect(function(h)
- if h.Parent:FindFirstChildOfClass("Humanoid") and h.Parent ~= c then
- local hum = h.Parent:FindFirstChildOfClass("Humanoid")
- hum.Health = 0
- h:BreakJoints()
- end
- end)
- wait(1)
- lol:disconnect()
- end)]]
- end
- end
- function shoot.lightning(b)
- local h,p,r
- local ignore = {c}
- local cpos = muzzle.CFrame.p
- local parts = {}
- local reps = 0
- local rotoff = Vector3.new()
- local sound = laser2:Clone()
- sound.Parent = muzzle
- sound:Play()
- game.Debris:AddItem(sound,1)
- mf1:Emit(4)
- mf2:Emit(4)
- repeat
- rotoff = Vector3.new(math.random(-100,100),math.random(-100,100),math.random(-100,100))/1300
- reps = reps + 1
- h,p,r = workspace:FindPartOnRayWithIgnoreList(Ray.new(
- cpos,
- ((CFrame.new(muzzle.CFrame.p,b.p).lookVector)+(rotoff))*12
- ),ignore)
- --laser
- local dist = (cpos-p).magnitude
- local laser = Instance.new("Part")
- laser.Color = maincol
- laser.Material = "Neon"
- laser.Size = Vector3.new(.4,.4,dist)
- laser.CFrame = CFrame.new(cpos,p)*CFrame.new(0,0,-dist/2)
- laser.Anchored = true
- laser.CanCollide = false
- laser.Parent = c
- parts[#parts+1]=laser
- if h then
- end
- cpos = p
- until h ~= nil or reps > 10
- for i,v in next,parts do
- game.Debris:AddItem(v,.03)
- end
- local explosion = Instance.new("Explosion")
- explosion.Visible =false
- explosion.BlastRadius = 1
- explosion.BlastPressure = 0
- explosion.Position = p
- explosion.Parent = workspace
- explosion.Hit:connect(function(h)
- if h.Parent:FindFirstChildOfClass("Humanoid") and h.Parent ~= c then
- local hum = h.Parent:FindFirstChildOfClass("Humanoid")
- hum.Health = 0
- h:BreakJoints()
- end
- end)
- end
- end
- event.OnServerEvent:connect(function(p,fn,...)
- funcs[fn](...)
- end)
- c.Animate:Destroy()
- local firing = false
- local state = "idle"
- funcs.state = function(ste)
- state = ste
- end
- funcs.aimpos = function(pos)
- pointcf = pos
- mouse.hit = pos
- end
- funcs.mouse = function(on)
- mouse.mouse1 = on
- end
- --wait(.3)
- local hostile = false
- local rate = 0
- local ammo = 1
- funcs.switch = function()
- rate = 0
- ammo = ammo + 1
- if ammo >= 3 then
- ammo = 1
- end
- end
- local ostate = state
- funcs.hostile = function()
- hostile = not hostile
- ostate = "none"
- end
- gamestep.Event:connect(function()
- if hostile == true then
- if state ~= ostate then
- if state == "idle" then
- rig:play("idleh",anims.idleaim,true,2,.4,true,true,function() end)
- ostate = state
- elseif state == "walk" then
- rig:play("walkh",anims.walkaim,true,1.5,.14,true,true,function() end)
- ostate = state
- end
- end
- else
- if state ~= ostate then
- if state == "idle" then
- rig:play("idle",anims.idle,true,2,.4,true,true,function() end)
- ostate = state
- elseif state == "walk" then
- rig:play("walk",anims.walk,true,1.5,.14,true,true,function() end)
- ostate = state
- end
- end
- end
- mf2.Color = ColorSequence.new(maincol)
- mf3.Color = ColorSequence.new(maincol)
- mf1.Color = ColorSequence.new(maincol)
- recoil=recoil:Lerp(CFrame.new(),.2)
- if hostile == true then
- if mouse.mouse1 == true then
- if ammo == 1 then
- maincol = Color3.fromRGB(128, 187, 219)
- if rate<tick() then
- rate = tick()+.08
- shoot.lightning(mouse.hit)
- end
- elseif ammo == 2 then
- maincol = Color3.fromRGB(218, 137, 117)
- if rate<tick() then
- rate = tick()+.09
- spawn(function()
- shoot.bullet(mouse.hit)
- end)
- end
- end
- else
- end
- end
- rig:step()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement