Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --TitanEngine
- local player = game.Players.LocalPlayer
- local character = game.Players.LocalPlayer.Character
- local camera = workspace.CurrentCamera
- local storage = game.ReplicatedStorage.Resources.Client
- --
- local runs = game:GetService("RunService")
- local uis = game:GetService("UserInputService")
- --
- local main = CFrame.new()
- local walkcf = CFrame.new()
- local breath = CFrame.new()
- local state = "Idle"
- --
- local firing = false
- local reloading = false
- local aiming = false
- local busy = false
- local running = false
- local walking = false
- local isbreath = 1
- local iswalk = 2
- local walkoffset = 0.2
- --
- local stepwait = 12
- local stepwalk = 0.1
- --
- local guns = {"AKS-74U"}
- local gun = guns[1]
- local gunModel = storage.Weapons:FindFirstChild(gun):Clone()
- local mainpart = gunModel.PrimaryPart
- local data = require(storage.Module:FindFirstChild(gun):Clone())
- repeat wait() until mainpart
- for i,parts in pairs(gunModel:GetChildren()) do
- if parts ~= gunModel.PrimaryPart then
- local gunWeld = Instance.new("ManualWeld",parts)
- gunWeld.Part0 = gunModel.PrimaryPart
- gunWeld.Part1 = parts
- gunWeld.C1 = parts.CFrame:inverse()*gunWeld.Part0.CFrame
- gunWeld.Name = parts.Name.."Weld"
- gunModel.Parent = camera
- parts.Anchored = false
- parts.CanCollide = false
- end
- end
- uis.InputBegan:Connect(function(input,process)
- if not process then
- if input.KeyCode == Enum.KeyCode.A then
- if state ~= "Right" then
- state = "Left"
- end
- end
- if input.KeyCode == Enum.KeyCode.D then
- if state ~= "Left" then
- state = "Right"
- end
- end
- end
- end)
- uis.InputEnded:Connect(function(input,process)
- if not process then
- if input.KeyCode == Enum.KeyCode.A then
- if state ~= "Right" then
- state = "Idle"
- end
- end
- if input.KeyCode == Enum.KeyCode.D then
- if state ~= "Left" then
- state = "Idle"
- end
- end
- end
- end)
- character.Humanoid.Running:Connect(function(s)
- if s > 1 then
- walking = true
- character.Humanoid.WalkSpeed = 20
- else
- walking = false
- character.Humanoid.WalkSpeed = 16
- end
- end)
- function positionSettings()
- local gunpos = data.main
- mainpart.CFrame = camera.CFrame*gunpos*main*breath
- if state == "Left" then
- main = main:lerp(CFrame.Angles(0,0,math.rad(10)),.1)
- end
- if state == "Right" then
- main = main:lerp(CFrame.Angles(0,0,math.rad(-10)),.1)
- end
- breath = breath:lerp(CFrame.new(),.1)
- main = main:lerp(CFrame.new(),.1)
- if not walking then
- if isbreath == 1 then
- breath = breath:lerp(breath*CFrame.new(0,0.01,0),.1)
- end
- if isbreath == 2 then
- breath = breath:lerp(breath*CFrame.new(0,0.015,0),.1)
- end
- if isbreath == 3 then
- breath = breath:lerp(breath*CFrame.new(0,0.02,0),.1)
- end
- if isbreath == 4 then
- breath = breath:lerp(breath*CFrame.new(0,0.025,0),.1)
- end
- if isbreath == 5 then
- breath = breath:lerp(breath*CFrame.new(0,0.03,0),.1)
- end
- if isbreath == 6 then
- breath = breath:lerp(breath*CFrame.new(0,0.025,0),.1)
- end
- if isbreath == 7 then
- breath = breath:lerp(breath*CFrame.new(0,0.02,0),.1)
- end
- if isbreath == 8 then
- breath = breath:lerp(breath*CFrame.new(0,0.015,0),.1)
- end
- if isbreath == 9 then
- breath = breath:lerp(breath*CFrame.new(0,0.01,0),.1)
- end
- else
- if iswalk == 1 then
- breath = breath:lerp(breath*CFrame.new(0,0,0)*CFrame.Angles(0,math.rad(0),0),walkoffset)
- end
- if iswalk == 2 then
- breath = breath:lerp(breath*CFrame.new(0.01,0.005,0)*CFrame.Angles(0,math.rad(0.1),0),walkoffset)
- end
- if iswalk == 3 then
- breath = breath:lerp(breath*CFrame.new(0.015,0.01,0)*CFrame.Angles(0,math.rad(0.2),0),walkoffset)
- end
- if iswalk == 4 then
- breath = breath:lerp(breath*CFrame.new(0.02,0.015,0)*CFrame.Angles(0,math.rad(0.3),0),walkoffset)
- end
- if iswalk == 5 then
- breath = breath:lerp(breath*CFrame.new(0.015,0.01,0)*CFrame.Angles(0,math.rad(0.2),0),walkoffset)
- end
- if iswalk == 6 then
- breath = breath:lerp(breath*CFrame.new(0.01,0.005,0)*CFrame.Angles(0,math.rad(0.1),0),walkoffset)
- end
- if iswalk == 7 then
- breath = breath:lerp(breath*CFrame.new(0,0,0)*CFrame.Angles(0,math.rad(0),0),walkoffset)
- end
- if iswalk == 8 then
- breath = breath:lerp(breath*CFrame.new(-0.01,0.005,0)*CFrame.Angles(0,math.rad(-0.1),0),walkoffset)
- end
- if iswalk == 9 then
- breath = breath:lerp(breath*CFrame.new(-0.015,0.01,0)*CFrame.Angles(0,math.rad(-0.2),0),walkoffset)
- end
- if iswalk == 10 then
- breath = breath:lerp(breath*CFrame.new(-0.02,0.015,0)*CFrame.Angles(0,math.rad(-0.3),0),walkoffset)
- end
- if iswalk == 11 then
- breath = breath:lerp(breath*CFrame.new(-0.015,0.01,0)*CFrame.Angles(0,math.rad(-0.2),0),walkoffset)
- end
- if iswalk == 12 then
- breath = breath:lerp(breath*CFrame.new(-0.01,0.005,0)*CFrame.Angles(0,math.rad(-0.1),0),walkoffset)
- end
- end
- end
- runs.RenderStepped:Connect(function()
- camera.CFrame = camera.CFrame*CFrame.new(0,-0.1,3)
- positionSettings()
- end)
- while true do
- runs.RenderStepped:Wait()
- if not walking then
- wait(runs.RenderStepped:Wait()*stepwait)
- isbreath = isbreath + 1
- if isbreath == 9 then
- isbreath = 1
- end
- else
- wait(runs.RenderStepped:Wait()*stepwalk)
- iswalk = iswalk + 1
- if iswalk == 12 then
- iswalk = 1
- end
- end
- end
- runs:BindToRenderStep("smoof",Enum.RenderPriority.Camera.Value == Enum.RenderPriority.Camera.Value+2 ,positionSettings() )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement