--|| SERVICES ||-- local UserInputService = game:GetService("UserInputService") local StarterPlayer = game:GetService("StarterPlayer") local Players = game:GetService("Players") local RunService = game:GetService("RunService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Debris = game:GetService("Debris") local SoundService = game:GetService("SoundService") local TweenService = game:GetService("TweenService") local StarterGui = game:GetService("StarterGui") local ChatService = game:GetService("Chat") local CollectionService = game:GetService("CollectionService") local UserInputService = game:GetService("UserInputService") local ContextActionService = game:GetService("ContextActionService") local Lighting = game:GetService("Lighting") local Camera = workspace.CurrentCamera --|| VARIABLES ||-- local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid = Character:WaitForChild("Humanoid") local Mouse = Player:GetMouse() local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") local Torso = Character.Torso local RootJoint = HumanoidRootPart.RootJoint local LeftHipJoint = Torso["Left Hip"] local RightHipJoint = Torso["Right Hip"] local Force = nil local Direction = nil local Value1 = 0 local Value2 = 0 local Tick = math.pi/0 local Z = 0 local Damping = Humanoid.WalkSpeed/2 local RootJointC0 = RootJoint.C0 local LeftHipJointC0 = LeftHipJoint.C0 local RightHipJointC0 = RightHipJoint.C0 local Neck = Character:FindFirstChild("Neck", true) local YOffset = Neck.C0.Y local CFNew, CFAng = CFrame.new, CFrame.Angles local asin = math.asin local grounded = false local jumpCooldown = 0.5 local Jumped = false local Assets = ReplicatedStorage:WaitForChild("Assets") local ClientModules = Assets:WaitForChild("Modules") local Remotes = Assets:WaitForChild("Remotes") --|| MODULES ||-- local Function = require(ClientModules.Function) local Thread = require(ClientModules.Thread) local CameraShaker = require(ClientModules.CameraShaker) Thread:Wait() --|| ANIMATION ||-- local FrontDash = Function.LoadAnimation(Humanoid, Assets.Animations.Dash.FrontDash, "FrontDash") local LeftDash = Function.LoadAnimation(Humanoid, Assets.Animations.Dash.LeftDash, "LeftDash") local RightDash = Function.LoadAnimation(Humanoid, Assets.Animations.Dash.RightDash, "RightDash") local BackDash = Function.LoadAnimation(Humanoid, Assets.Animations.Dash.BackDash, "BackDash") --|| FUNCTIONS ||-- local function Lerp(a, b, c) return a + (b - a) * c end local function mix(par1, par2, factor) return par2 + (par1 - par2) * factor end Humanoid.Climbing:Connect(function(Speed) climbingSpeed = Speed end) Humanoid.Jumping:Connect(function() grounded = false end) Humanoid.FreeFalling:Connect(function() grounded = false TweenService:Create(Camera, TweenInfo.new(0.3, Enum.EasingStyle.Quint), {FieldOfView = Camera.FieldOfView + 5}):Play() end) --|| MAIN ||-- local CameraShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame) Camera.CFrame = Camera.CFrame * shakeCFrame end) CameraShake:Start() Humanoid.StateChanged:Connect(function(newState) if newState == Enum.HumanoidStateType.Landed then grounded = true Function.CreateParticle(Assets.Particles.FootParticles, 20, HumanoidRootPart.CFrame * CFrame.new(0,-3,.5),0 ) if HumanoidRootPart:GetAttribute("Sprinting", false) then TweenService:Create(Camera, TweenInfo.new(0.3, Enum.EasingStyle.Quint), {FieldOfView = 70}):Play() else TweenService:Create(Camera, TweenInfo.new(0.3, Enum.EasingStyle.Quint), {FieldOfView = 75}):Play() end Assets.Remotes.HitEffect:Fire("TinyBump", { Time = 0.2, Color = Color3.fromRGB(255, 255, 255), Brightness = 0, }) end end) UserInputService.JumpRequest:Connect(function() if not Jumped then if Humanoid.FloorMaterial == Enum.Material.Air then return end -- Prevent mid air jumps Jumped = true --Making it true do it does not loop twice Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) --Making the character jump task.wait(jumpCooldown) -- yield x Jumped = false --Make it false so we can repeat it again else Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false) end end) UserInputService.InputBegan:Connect(function(input, gp) if gp then return end if input.KeyCode == Enum.KeyCode.LeftShift then Remotes.Speed:FireServer(true) if Humanoid.MoveDirection ~= Vector3.new(0, 0, 0) then TweenService:Create(Camera, TweenInfo.new(0.5, Enum.EasingStyle.Quint), {FieldOfView = 75}):Play() end end if input.KeyCode == Enum.KeyCode.E then if not Character:FindFirstChild("DashCooldown") and Humanoid.MoveDirection.Magnitude > 0 then local BV = Instance.new("BodyVelocity", HumanoidRootPart) BV.Name = "DashVelocity" BV.MaxForce = Vector3.new(100000 / 2,1000,100000 / 2) if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then if (Humanoid.MoveDirection:Dot(Camera.CFrame.RightVector) > 0.75) then BV.Velocity = HumanoidRootPart.CFrame.RightVector * 70 RightDash:Play() elseif (Humanoid.MoveDirection:Dot(Camera.CFrame.RightVector) < -0.75) then BV.Velocity = HumanoidRootPart.CFrame.RightVector * -70 LeftDash:Play() elseif (Humanoid.MoveDirection:Dot(Camera.CFrame.LookVector) > 0.75) then BV.Velocity = HumanoidRootPart.CFrame.LookVector * 70 FrontDash:Play() elseif (Humanoid.MoveDirection:Dot(Camera.CFrame.LookVector) < -0.75) then BV.Velocity = HumanoidRootPart.CFrame.LookVector * -70 BackDash:Play() else BV.Velocity = HumanoidRootPart.CFrame.LookVector * 70 FrontDash:Play() end else BV.Velocity = HumanoidRootPart.CFrame.LookVector * 70 FrontDash:Play() end TweenService:Create(Camera, TweenInfo.new(0.5, Enum.EasingStyle.Quint), {FieldOfView = Camera.FieldOfView + 10}):Play() Assets.Remotes.Dash:FireServer(Player) Function.AddCooldown(Character, "DashCooldown", 1) Debris:AddItem(BV, .3) Function.CreateParticle(Assets.Particles.FootParticles, 20, HumanoidRootPart.CFrame * CFrame.new(0,-3,.5),0 ) task.delay(.3, function() TweenService:Create(Camera, TweenInfo.new(0.5, Enum.EasingStyle.Quint), {FieldOfView = 70}):Play() Function.CreateParticle(Assets.Particles.FootParticles, 20, HumanoidRootPart.CFrame * CFrame.new(0,-3,.5),0 ) if grounded then Assets.Remotes.HitEffect:Fire("TinyBump", { Time = 0.5, Color = Color3.fromRGB(255, 255, 255), Brightness = 0, }) end end) end end end) UserInputService.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then Remotes.Speed:FireServer(false) TweenService:Create(Camera, TweenInfo.new(0.5, Enum.EasingStyle.Quint), {FieldOfView = 70}):Play() end end) Assets.Remotes.HitEffect.Event:Connect(function(ShakeType, Visualize) if ShakeType then CameraShake:Shake(CameraShake:Shake(CameraShaker.Presets[ShakeType])) end if Visualize and typeof(Visualize) == "table" then local VisualizeEffect = Instance.new("ColorCorrectionEffect") VisualizeEffect.Parent = Camera VisualizeEffect.TintColor = Visualize.Color VisualizeEffect.Brightness = Visualize.Brightness Debris:AddItem(VisualizeEffect, Visualize.Time + 1) TweenService:Create(VisualizeEffect, TweenInfo.new(Visualize.Time, Enum.EasingStyle.Quint), {Brightness = 0}):Play() end end) Thread:Spawn(function() local Sounds = Assets.SFX.Movement.Footsteps while Humanoid.RootPart do if Function.characterOnWorkspace(Character) == false then break end if Humanoid.Health <= 0 then break end local Moving = (Humanoid.RootPart.Velocity - Vector3.new(0, Humanoid.RootPart.Velocity.Y, 0)).Magnitude local Rate = (StarterPlayer.CharacterWalkSpeed/3)/Moving if Humanoid.RootPart:GetAttribute("Sprinting", false) then Rate = (StarterPlayer.CharacterWalkSpeed/2.3)/Moving else Rate = (StarterPlayer.CharacterWalkSpeed/3)/Moving end local Walking = Moving > 2 and Humanoid.FloorMaterial ~= Enum.Material.Air if Walking or Humanoid:GetState() == Enum.HumanoidStateType.Climbing then local Name = "Brick" if math.abs(Humanoid.RootPart.Velocity.Y) > 0.1 and Humanoid:GetState() == Enum.HumanoidStateType.Climbing then Name = "Ladder" Thread:Spawn(function() local Material_Folder = Sounds:WaitForChild("Ladder"):Clone() local Sound = Material_Folder:GetChildren()[math.random(1, #Material_Folder:GetChildren())]:Clone() Sound.Parent = Humanoid.RootPart Sound.Name = Sound.Name Sound.PlaybackSpeed = Sound.PlaybackSpeed + math.random(-20, 30)/100 Sound:Play() game:GetService(Sound, Sound.TimeLength + 0.1) Debris:AddItem(Sound, 5) end) elseif Walking and Humanoid:GetState() ~= Enum.HumanoidStateType.Climbing then if Sounds:FindFirstChild(Humanoid.FloorMaterial.Name) then Name = Humanoid.FloorMaterial.Name else Name = "Brick" end Thread:Spawn(function() local Material_Folder = Sounds:WaitForChild(Name):Clone() local Sound = Material_Folder:GetChildren()[math.random(1, #Material_Folder:GetChildren())]:Clone() Sound.Parent = Humanoid.RootPart Sound.Name = Sound.Name .. " (Playing)" Sound.PlaybackSpeed = Sound.PlaybackSpeed + math.random(-20, 30)/100 Sound:Play() if HumanoidRootPart:GetAttribute("Sprinting", true) then Function.CreateParticle(Assets.Particles.FootParticles, 10, HumanoidRootPart.CFrame * CFrame.new(0,-3,0),0 ) end game:GetService(Sound, Sound.TimeLength + 0.1) Debris:AddItem(Sound, 5) end) end end if Walking then Thread:Wait(Rate) elseif Humanoid:GetState() == Enum.HumanoidStateType.Climbing then local climbRate = (StarterPlayer.CharacterWalkSpeed/3)/math.abs(climbingSpeed) * 1 Thread:Wait(climbRate) else Thread:Wait() end end end) RunService.RenderStepped:Connect(function() Force = HumanoidRootPart.Velocity * Vector3.new(1,0,1) local CameraDirection = HumanoidRootPart.CFrame:toObjectSpace(Camera.CFrame).lookVector if Neck then if Character.Humanoid.RigType == Enum.HumanoidRigType.R15 then Neck.C0 = CFNew(0, YOffset, 0) * CFAng(0, -asin(CameraDirection.x), 0) * CFAng(asin(CameraDirection.y), 0, 0) elseif Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then Neck.C0 = CFNew(0, YOffset, 0) * CFAng(3 * math.pi/2, 0, math.pi) * CFAng(0, 0, -asin(CameraDirection.x)) * CFAng(-asin(CameraDirection.y), 0, 0) end end if Force.Magnitude > 2 then Direction = Force.Unit Value1 = HumanoidRootPart.CFrame.RightVector:Dot(Direction) Value2 = HumanoidRootPart.CFrame.LookVector:Dot(Direction) else Value1 = 0 Value2 = 0 end if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter and not Function.IsFirstPerson(Character.Head) and Humanoid.Health > 0 then if Humanoid.CameraOffset ~= Vector3.new(2, .4, 0) then TweenService:Create(Humanoid, TweenInfo.new(0.3, Enum.EasingStyle.Quad), {CameraOffset = Vector3.new(2, .4, 0)}):Play() end elseif UserInputService.MouseBehavior == Enum.MouseBehavior.Default or Function.IsFirstPerson(Character.Head) then if Humanoid.CameraOffset ~= Vector3.new(0, 0, 0) then TweenService:Create(Humanoid, TweenInfo.new(0.08, Enum.EasingStyle.Quad), {CameraOffset = Vector3.new(0, 0, 0)}):Play() end end if Humanoid.MoveDirection ~= Vector3.new(0, 0, 0) and HumanoidRootPart:GetAttribute("Sprinting", true) and Camera.FieldOfView ~= 75 and HumanoidRootPart:GetAttribute("Dash", true) then TweenService:Create(Camera, TweenInfo.new(0.8, Enum.EasingStyle.Quint), {FieldOfView = 75}):Play() else if grounded then TweenService:Create(Camera, TweenInfo.new(0.5, Enum.EasingStyle.Quint), {FieldOfView = 70}):Play() end end RootJoint.C0 = RootJoint.C0:Lerp(RootJointC0 * CFrame.Angles(math.rad(Value2 * 5), math.rad(-Value1 * 10), 0), 0.2) LeftHipJoint.C0 = LeftHipJoint.C0:Lerp(LeftHipJointC0 * CFrame.Angles(math.rad(Value1 * 10), 0, 0), 0.2) RightHipJoint.C0 = RightHipJoint.C0:Lerp(RightHipJointC0 * CFrame.Angles(math.rad(-Value1 * 10), 0, 0), 0.2) end) -- ... (Kodun diğer kısımları aynı kalır) UserInputService.JumpRequest:Connect(function() Jumped değilse ve topraklanmışsa ve Humanoid.Sit değilse -- Karakter yerdeyse ve oturmuyorsa, zıplamasına izin verin Atladı = true İnsansı:Durum Değiştir(Enum.HumanoidStateType.Jumping) task.wait(jumpCooldown) Atlandı = false elseif Humanoid.Sit then -- Eğer karakter oturuyorsa, kalkmasını sağlayın Humanoid.Sit = false -- Karakteri koltuktan kaldırır son son) -- ... (Kodun geri kalanı aynı kalır)