Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cam = workspace.CurrentCamera
- game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
- local arms = game.ReplicatedStorage.ViewmodelArms:Clone()
- arms.Parent = cam
- local lshoulder = arms.LeftUpperArm.LeftShoulder
- local rshoulder = arms.RightUpperArm.RightShoulder
- local gun = game.ReplicatedStorage.Gun:Clone()
- gun.Parent = arms
- local m6d = Instance.new("Motor6D")
- m6d.C0 = CFrame.new(1, -0.3, -2.3)
- m6d.Part0 = arms.Head
- m6d.Part1 = gun.PrimaryPart
- m6d.Parent = arms.Head
- local ads = false
- game.Players.LocalPlayer:GetMouse().Button2Down:Connect(function()
- ads = true
- end)
- game.Players.LocalPlayer:GetMouse().Button2Up:Connect(function()
- ads = false
- end)
- game:GetService("RunService").RenderStepped:Connect(function()
- arms.Head.CFrame = cam.CFrame
- local aimC1 = m6d.C0 - Vector3.new(0.177, 0.34, -1)
- local c1 = ads and aimC1 or CFrame.new()
- m6d.C1 = m6d.C1:Lerp(c1, 0.2)
- local cf = gun.Left.CFrame * CFrame.Angles(math.rad(90), 0, math.rad(20)) * CFrame.new(0, 1.3, 0)
- lshoulder.C1 = cf:Inverse() * lshoulder.Part0.CFrame * lshoulder.C0
- local cf = gun.Right.CFrame * CFrame.Angles(math.rad(90), 0, math.rad(-10)) * CFrame.new(0, 1.3, 0)
- rshoulder.C1 = cf:Inverse() * rshoulder.Part0.CFrame * rshoulder.C0
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement