Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local p = game.Players.LocalPlayer
- local c = p.Character
- local m = p:GetMouse()
- c.Animate:Destroy()
- for i,v in next,c.Humanoid:GetPlayingAnimationTracks() do
- v:Stop()
- end
- local rightarm = c["Right Arm"]
- local leftarm = c["Left Arm"]
- local rad = math.pi/180
- local origins = {
- RA = CFrame.new(-.3,0,-.8)*CFrame.Angles(0,0,math.pi*.5),
- LA = CFrame.new(-1,-.2,-1.3)*CFrame.Angles(0,-40*rad,-100*rad),
- RL = CFrame.new(0,0,0),
- LL = CFrame.new(0,0,0),
- Root = CFrame.new()*CFrame.Angles(0,0,-50*rad),
- Neck = CFrame.Angles(0,0,50*rad),
- }
- local animations = {
- reload = {
- {
- RA = CFrame.new(-.3,0,-.8)*CFrame.Angles(0,10*rad,math.pi*.6),
- LA = CFrame.new(-1,-.2,-1.3)*CFrame.Angles(0,-40*rad,-100*rad),
- RL = CFrame.new(0,0,0),
- LL = CFrame.new(0,0,0),
- Root = CFrame.new()*CFrame.Angles(0,0,-10*rad),
- Neck = CFrame.Angles(0,0,10*rad),
- frametime = .5,
- },
- {
- RA = CFrame.new(-.3,0,-.8)*CFrame.Angles(0,10*rad,math.pi*.6),
- LA = CFrame.new(-1,-.2,-1.3)*CFrame.Angles(0,-40*rad,-70*rad),
- RL = CFrame.new(0,0,0),
- LL = CFrame.new(0,0,0),
- Root = CFrame.new()*CFrame.Angles(0,0,-10*rad),
- Neck = CFrame.Angles(0,0,10*rad),
- frametime = .5,
- },
- }
- }
- local attachments = {
- RA = c.Torso["Right Shoulder"],
- RL = c.Torso["Right Hip"],
- LA = c.Torso["Left Shoulder"],
- LL = c.Torso["Left Hip"],
- Root = c.HumanoidRootPart.RootJoint,
- Neck = c.Torso.Neck,
- }
- local poses = {
- RA = CFrame.new(0,0,0),
- LA = CFrame.new(0,0,0),
- RL = CFrame.new(0,0,0),
- LL = CFrame.new(0,0,0),
- Root = CFrame.new(),
- }
- local recoil = CFrame.new()
- local recoil2 = CFrame.new()
- local ins = Instance.new
- local gunpart = ins("Part")
- gunpart.CanCollide = false
- local gunweld = ins("Weld",gunpart)
- gunweld.Part0 = gunpart
- gunweld.Part1 = rightarm
- gunweld.C0 = CFrame.Angles(-math.pi*.5,math.pi,0) * CFrame.new(0,1,.3)
- local gunc0 = CFrame.Angles(-math.pi*.5,math.pi,0) * CFrame.new(0,1,.3)
- local gunmesh = ins("SpecialMesh",gunpart)
- gunmesh.MeshId = "rbxassetid://449919548"
- gunmesh.TextureId = "rbxassetid://449919568"
- gunmesh.Offset = Vector3.new(0, 0.2, 0.7)
- gunmesh.Scale = Vector3.new(0.015, 0.015, 0.015)
- local sound = ins("Sound",gunpart)
- sound.SoundId = "rbxassetid://2016246584"
- gunpart.Parent = workspace
- local rs = game:GetService("RunService").RenderStepped
- local currentanim = nil
- local function playanimation(animation)
- local framenum = #animation
- local currentframe = 1
- local framewait = 0
- local self = {}
- self.stop = false
- function self:start()
- repeat
- framewait = tick() + animation[currentframe].frametime
- for i,v in next,animation[currentframe] do
- if i ~= "frametime" then
- poses[i] = v
- end
- end
- repeat wait() until framewait < tick() or self.stop == true
- currentframe = currentframe + 1
- until currentframe > framenum or self.stop == true
- currentanim = nil
- self = nil
- end
- return self
- end
- local ammo = 10
- local waitshoot = 0
- local rpm = 100
- local shootdown = false
- local aiming = false
- function bloom(pos,size,col,r,m,c)
- spawn(function()
- local bloomp = ins("Part")
- bloomp.Shape = "Ball"
- bloomp.Anchored = true
- bloomp.CanCollide = false
- bloomp.Material = m or "Neon"
- bloomp.Color = col
- bloomp.CFrame = CFrame.new(pos)
- bloomp.Size = Vector3.new()
- bloomp.Parent = gunpart
- game.Debris:AddItem(bloomp,3)
- local a = .05
- if r then
- a = r
- end
- local change = CFrame.new()
- if c then
- change = c
- end
- repeat
- local oldp = bloomp.CFrame
- bloomp.Transparency = bloomp.Transparency + a
- bloomp.Size = bloomp.Size:lerp(Vector3.new(size,size,size),.3)
- bloomp.CFrame = oldp * change
- rs:wait()
- until bloomp.Transparency == 1
- game.Debris:AddItem(bloomp,0)
- end)
- end
- local posting = CFrame.new(-0.05,0.05,4.3)
- function shoot()
- if shootdown == true then
- if waitshoot > tick() then return end
- waitshoot = tick() + (60/rpm)
- for i = 1,math.random(3,4) do
- bloom((gunpart.CFrame*posting*CFrame.new(math.random(-10,10)/80,.5+math.random(-10,10)/80,-1)).p,math.random(10,15)/20,Color3.fromRGB(255, math.random(10,190), 0),.3)
- end
- local ray = Ray.new((gunpart.CFrame*posting).p,gunpart.CFrame.lookVector*-999)
- local h,pos,r = workspace:FindPartOnRayWithIgnoreList(ray,{c,gunpart})
- local dist = ((gunpart.CFrame*posting).p-pos).magnitude
- local raything = ins("Part")
- local olde = (gunpart.CFrame*posting)
- raything.Transparency = 1
- raything.Size = Vector3.new(.1,.1,10)
- raything.Anchored = true
- raything.CanCollide = false
- raything.Material = "Neon"
- raything.Parent = gunpart
- raything.CFrame = olde
- spawn(function()
- game.Debris:AddItem(raything,2)
- for i = 0,3 do
- if raything.CFrame.p == pos then
- raything:Destroy()
- else
- raything.CFrame = raything.CFrame:lerp(CFrame.new(pos)*(olde-olde.p),((i/3)/dist)*100)
- raything.Transparency = raything.Transparency - .3
- rs:wait()
- end
- end
- raything:Destroy()
- end)
- sound:Play()
- recoil = recoil * CFrame.new(-.2,0,0) * CFrame.Angles(0,0,2*rad)
- recoil2 = recoil2 * CFrame.new(.2,0,0) * CFrame.Angles(0,0,-2*rad)
- if h then
- if h.Parent:IsA("Accessory") then
- h.Parent:Destroy()
- end
- if h.Parent:FindFirstChildOfClass("Humanoid") then
- h.Parent:FindFirstChildOfClass("Humanoid").Health = h.Parent:FindFirstChildOfClass("Humanoid").Health - (110/(math.random(10,12)/10))
- if h.Name == "Head" then
- h:Destroy()
- end
- end
- end
- end
- end
- local ff = Instance.new("ForceField",c)
- ff.Visible = false
- m.Button1Down:connect(function()
- shootdown = true
- end)
- m.Button1Up:connect(function()
- shootdown = false
- end)
- local aimbottarg = nil
- m.Button2Down:connect(function()
- aiming = true
- if m.Target then
- aimbottarg = m.Target
- end
- end)
- m.Button2Up:connect(function()
- aiming = false
- end)
- local running = false
- m.KeyDown:connect(function(k)
- if k == "r" then
- if currentanim then
- currentanim.stop = true
- end
- currentanim = playanimation(animations.reload)
- currentanim:start()
- end
- if k == "0" then
- running = true
- end
- end)
- m.KeyUp:connect(function(k)
- if k == "0" then
- running = false
- end
- end)
- print(attachments.LA.C0)
- local rleg = attachments.RL.C0
- local lleg = attachments.LL.C0
- local neck = attachments.Neck.C0
- local hrp = attachments.Root.C0
- local head = c.Head
- local walktick = 0
- local look = CFrame.new()
- m.TargetFilter = gunpart
- local cam = workspace.CurrentCamera
- game:GetService("RunService"):BindToRenderStep("hey2",999999999999,function(dt)
- c.Humanoid.MaxHealth = math.huge
- c.Humanoid.Health = math.huge
- end)
- game:GetService("RunService"):BindToRenderStep("hey",0,function(dt)
- leftarm.LocalTransparencyModifier = 0
- rightarm.LocalTransparencyModifier = 0
- shoot()
- local tock = tick()
- if currentanim == nil then
- for i,v in next,poses do
- poses[i] = origins[i]
- end
- end
- if running then
- c.Humanoid.WalkSpeed = 40
- c.Humanoid.JumpPower = 120
- else
- c.Humanoid.WalkSpeed = 23
- c.Humanoid.JumpPower = 60
- end
- walktick = walktick + (c.HumanoidRootPart.Velocity.magnitude/80)
- look = CFrame.new(head.CFrame.p,m.Hit.p)
- --look = look-look.p
- local ctos = c.Torso.CFrame:toObjectSpace(look)
- local cx,cy,cz = ctos:toEulerAnglesXYZ()
- local cx2,cy2,cz2 = look:toEulerAnglesXYZ()
- attachments.RL.C0 = rleg * CFrame.Angles(0,0,math.sin(-walktick)*.4)*CFrame.new(0,math.max(math.cos(walktick+math.pi)*.4,0),0)
- attachments.LL.C0 = lleg * CFrame.Angles(0,0,math.sin(-walktick)*.4)*CFrame.new(0,math.max(math.cos(walktick)*.4,0),0)
- if aiming then
- cam.FieldOfView = 30
- if aimbottarg then
- cam.CFrame = CFrame.new(cam.CFrame.p,aimbottarg.CFrame.p)
- end
- else
- cam.FieldOfView = 80
- end
- for i,v in next,attachments do
- if i == "RA" then
- if aiming == false then
- v.Part0 = c.Head
- v.C0 = v.C0:lerp(CFrame.new(1,-1,0, 0, 0, 1, 0, 1, 0, -1, -0, -0) * recoil,math.min(dt*20,1))
- else
- v.Part0 = c.Head
- v.C0 = v.C0:lerp(CFrame.new(1,-1,0, 0, 0, 1, 0, 1, 0, -1, -0, -0) * recoil*CFrame.Angles(-10*rad,0,0),math.min(dt*20,1))
- end
- elseif i == "LA" then
- if aiming == false then
- v.Part0 = c.Head
- v.C0 = v.C0:lerp(CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) * recoil2,math.min(dt*20,1))
- else
- v.Part0 = c.Head
- v.C0 = v.C0:lerp(CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) * recoil2*CFrame.Angles(-3*rad,0,0),math.min(dt*20,1))
- end
- elseif i == "Neck" then
- if aiming == false then
- v.C0 = v.C0:lerp(CFrame.new(0,1.5,0)*(ctos-ctos.p),math.min(dt*10,1))
- else
- v.C0 = CFrame.new(0,1.5,0)*(ctos-ctos.p)*CFrame.Angles(0,0,-10*rad)
- end
- v.C1 = CFrame.new()
- elseif i == "Root" then
- --v.C0 = v.C0:lerp(hrp*CFrame.Angles(0,0,cy),math.min(dt*10,1))
- end
- if i == "Neck" then
- --v.Transform = v.Transform:lerp(CFrame.new(poses[i].p),math.min(dt,1)*10)
- else
- v.Transform = v.Transform:lerp(poses[i],math.min(dt*10,1))
- end
- end
- recoil = recoil:lerp(CFrame.new(),math.min(dt*10,1))
- recoil2 = recoil2:lerp(CFrame.new(),math.min(dt*10,1))
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement