Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script.Parent = game.Workspace:FindFirstChild("calternitive")
- local Character = script.Parent
- local T = Character.Torso
- local Humanoid = Character:FindFirstChildOfClass'Humanoid'
- local RootPart = Character:WaitForChild'HumanoidRootPart'
- local RootJoint = RootPart:WaitForChild'RootJoint'
- local RootC0 = RootJoint.C0
- local walking = false
- Humanoid.WalkSpeed = 30
- local MaxTiltAngle = 1 * Humanoid.WalkSpeed
- local TweenService = game:GetService("TweenService")
- local landing = false
- local jumping = false
- local slidetool = Instance.new("Tool")
- slidetool.Parent = game.Players:FindFirstChild(script.Parent.Name).Backpack
- slidetool.RequiresHandle = false
- slidetool.Name = "Slide"
- local sliding = false
- script.Parent:WaitForChild("Animate",3000000):Destroy()
- local animspeed = 0.2
- local wall = nil
- local hrp = script.Parent:WaitForChild("HumanoidRootPart")
- local wall
- game:GetService("RunService").Heartbeat:Connect(function()
- local raycastParams = RaycastParams.new()
- raycastParams.FilterDescendantsInstances = {script.Parent}
- local raycastResult = workspace:Raycast(script.Parent["Left Leg"].Position, hrp.CFrame.LookVector * 1.85, raycastParams)
- wall = raycastResult and raycastResult.Instance or nil
- if wall and (script.Parent.Humanoid.MoveDirection.Magnitude) > 0.01 then
- hrp.Velocity = Vector3.new(hrp.Velocity.X, script.Parent.Humanoid.WalkSpeed, hrp.Velocity.Z)
- if script.Parent.Humanoid:GetState() ~= Enum.HumanoidStateType.Climbing then script.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Climbing) end
- end
- end)
- function RunAnim()
- if walking and not landing and not jumping then
- TweenService:Create(T.Neck,TweenInfo.new(animspeed,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 1, 0, -1, -7.57103464e-08, -4.37113918e-08, 0, -0.50000006, 0.866025388, -8.74227766e-08, 0.866025388, 0.50000006)}):Play()
- TweenService:Create(T["Right Hip"],TweenInfo.new(animspeed,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, -1, 0, -2.18556924e-08, 3.78551732e-08, 1, 0.866025448, 0.49999997, 0, -0.49999997, 0.866025448, -4.37113883e-08)}):Play()
- TweenService:Create(T["Right Shoulder"],TweenInfo.new(animspeed,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, 0.5, 0, -3.09086197e-08, -3.09086197e-08, 1, -0.707106769, 0.707106769, 0, -0.707106769, -0.707106769, -4.37113883e-08)}):Play()
- TweenService:Create(T["Left Hip"],TweenInfo.new(animspeed,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, -1, 0, -3.09086197e-08, 3.09086197e-08, -1, 0.707106769, 0.707106769, 0, 0.707106769, -0.707106769, -4.37113883e-08)}):Play()
- TweenService:Create(T["Left Shoulder"],TweenInfo.new(animspeed,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, 0.5, 0, -3.09086197e-08, -3.09086197e-08, -1, -0.707106769, 0.707106769, 0, 0.707106769, 0.707106769, -4.37113883e-08)}):Play()
- else
- return
- end
- wait(animspeed)
- if walking and not landing and not jumping then
- TweenService:Create(T.Neck,TweenInfo.new(animspeed,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 1, 0, -1, -7.57103464e-08, -4.37113918e-08, 0, -0.50000006, 0.866025388, -8.74227766e-08, 0.866025388, 0.50000006)}):Play()
- TweenService:Create(T["Right Hip"],TweenInfo.new(animspeed,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, -1, 0, -2.18556924e-08, -3.78551732e-08, 1, -0.866025448, 0.49999997, 0, -0.49999997, -0.866025448, -4.37113883e-08)}):Play()
- TweenService:Create(T["Right Shoulder"],TweenInfo.new(animspeed,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, 0.5, 0, -2.18556924e-08, 3.78551732e-08, 1, 0.866025448, 0.49999997, 0, -0.49999997, 0.866025448, -4.37113883e-08)}):Play()
- TweenService:Create(T["Left Hip"],TweenInfo.new(animspeed,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, -1, -0.5, -2.18556924e-08, -3.78551732e-08, -1, -0.866025448, 0.49999997, 0, 0.49999997, 0.866025448, -4.37113883e-08)}):Play()
- TweenService:Create(T["Left Shoulder"],TweenInfo.new(animspeed,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, 0.5, 0, -2.18556924e-08, 3.78551732e-08, -1, 0.866025448, 0.49999997, 0, 0.49999997, -0.866025448, -4.37113883e-08)}):Play()
- else
- return
- end
- wait(animspeed)
- end
- function Idle()
- if not walking and not landing and not jumping then
- TweenService:Create(T.Neck,TweenInfo.new(0.1,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)}):Play()
- TweenService:Create(T["Right Hip"],TweenInfo.new(0.1,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)}):Play()
- TweenService:Create(T["Right Shoulder"],TweenInfo.new(0.1,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, -0.5, 0, -0.241844609, 0.939692676, 0.241844684, 0.707106829, -3.09086197e-08, 0.707106769, 0.664463043, 0.342019975, -0.664463103)}):Play()
- TweenService:Create(T["Left Hip"],TweenInfo.new(0.1,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, -1, 0, 0.173648104, 0.0858316571, -0.981060326, 0, 0.99619472, 0.0871557444, 0.984807789, -0.0151344296, 0.172987327)}):Play()
- TweenService:Create(T["Left Shoulder"],TweenInfo.new(0.1,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, -0.5, 0, -0.241844609, -0.939692676, -0.241844684, -0.707106829, -3.09086197e-08, 0.707106769, -0.664463043, 0.342019975, -0.664463103)}):Play()
- else
- return
- end
- end
- function Land()
- landing = true
- TweenService:Create(RootJoint,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, -1, 0, -1, -8.74227766e-08, -3.82137093e-15, 0, -4.37113883e-08, 1, -8.74227766e-08, 1, 4.37113883e-08)}):Play()
- TweenService:Create(T.Neck,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 1, 0, -1, -6.18172393e-08, 6.18172393e-08, 0, 0.707106769, 0.707106769, -8.74227766e-08, 0.707106769, -0.70710676)}):Play()
- TweenService:Create(T["Right Hip"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, 0, -0.5, 0.49999997, 0, 0.866025448, 0, 1, 0, -0.866025448, 0, 0.49999997)}):Play()
- TweenService:Create(T["Right Shoulder"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, 0.5, 0, 0.49999994, -0.5, 0.707106769, -0.49999997, 0.49999997, 0.707106769, -0.707106769, -0.707106769, -3.09086197e-08)}):Play()
- TweenService:Create(T["Left Hip"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-0.200000003, 0, -0.5, 0.707106769, 0, 0.707106769, 0, 1, 0, -0.707106769, 0, 0.707106769)}):Play()
- TweenService:Create(T["Left Shoulder"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, 0.5, 0, 0.49999994, 0.5, -0.707106769, 0.49999997, 0.49999997, 0.707106769, 0.707106769, -0.707106769, -3.09086197e-08)}):Play()
- wait(0.3)
- TweenService:Create(RootJoint,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 0, 0, -1, -1.50995803e-07, -6.60023616e-15, 0, -4.37113883e-08, 1, -1.50995803e-07, 1, 4.37113883e-08)}):Play()
- TweenService:Create(T.Neck,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 1, 0, -1, 7.57103464e-08, -4.37113847e-08, 0, 0.49999997, 0.866025448, 8.74227766e-08, 0.866025448, -0.49999997)}):Play()
- TweenService:Create(T["Right Hip"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0.5, -1, -0.100000001, 1, 0, 0, 0, 1, 0, 0, 0, 1)}):Play()
- TweenService:Create(T["Right Shoulder"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, 0.5, 0, -4.37113883e-08, -0.342020154, 0.939692616, 0, 0.939692616, 0.342020154, -1, 1.49501762e-08, -4.10752676e-08)}):Play()
- TweenService:Create(T["Left Hip"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-0.5, -1, -0.100000001, 1, 0, 0, 0, 1, 0, 0, 0, 1)}):Play()
- TweenService:Create(T["Left Shoulder"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0.342020154, -0.939692616, 0, 0.939692616, 0.342020154, 1, 1.49501762e-08, -4.10752676e-08)}):Play()
- wait(0.3)
- landing = false
- end
- function jump()
- jumping = true
- TweenService:Create(RootJoint,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 0, 0, -1, 8.60946301e-08, -1.51807988e-08, 0, 0.173648104, 0.984807789, 8.74227766e-08, 0.984807789, -0.173648104)}):Play()
- TweenService:Create(T.Neck,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 1, 0, -1, 8.74227766e-08, 0, -4.37113847e-08, -0.49999997, 0.866025448, 7.57103464e-08, 0.866025448, 0.49999997)}):Play()
- TweenService:Create(T["Right Hip"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, -1, 0, -1.49501709e-08, -4.10752712e-08, 1, -0.939692676, 0.342020035, 0, -0.342020035, -0.939692676, -4.37113883e-08)}):Play()
- TweenService:Create(T["Right Shoulder"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, 0.5, 0, -0.5, -0.49999994, 0.707106769, 0.49999997, 0.49999997, 0.707106769, -0.707106769, 0.707106769, -3.09086197e-08)}):Play()
- TweenService:Create(T["Left Hip"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, 0, -1, -3.34848664e-08, -2.80971406e-08, -1, -0.642787635, 0.766044438, 0, 0.766044438, 0.642787635, -4.37113883e-08)}):Play()
- TweenService:Create(T["Left Shoulder"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, 0.5, 0, -0.5, 0.49999994, -0.707106769, -0.49999997, 0.49999997, 0.707106769, 0.707106769, 0.707106769, -3.09086197e-08)}):Play()
- wait(0.3)
- jumping = false
- end
- function climb()
- TweenService:Create(RootJoint,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 0, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)}):Play()
- TweenService:Create(T.Neck,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 1, 0, -1, 6.18172393e-08, 6.18172393e-08, 0, -0.707106769, 0.707106769, 8.74227766e-08, 0.707106769, 0.707106769)}):Play()
- TweenService:Create(T["Right Hip"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, 0, -0.219999999, -4.37113883e-08, 0, 1, 0, 1, 0, -1, 0, -4.37113883e-08)}):Play()
- TweenService:Create(T["Right Shoulder"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)}):Play()
- TweenService:Create(T["Left Hip"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)}):Play()
- TweenService:Create(T["Left Shoulder"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, 0.5, 0, 4.37113883e-08, 3.82137093e-15, -1, 8.74227766e-08, -1, 0, -1, -8.74227766e-08, -4.37113883e-08)}):Play()
- wait(animspeed)
- TweenService:Create(RootJoint,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 0, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)}):Play()
- TweenService:Create(T.Neck,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 1, 0, -1, 6.18172393e-08, 6.18172393e-08, 0, -0.707106769, 0.707106769, 8.74227766e-08, 0.707106769, 0.707106769)}):Play()
- TweenService:Create(T["Right Hip"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, -1, 0, -4.37113883e-08, 0, 1, 0, 1, 0, -1, 0, -4.37113883e-08)}):Play()
- TweenService:Create(T["Right Shoulder"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, 0.5, 0, 4.37113883e-08, -3.82137093e-15, 1, -8.74227766e-08, -1, 0, 1, -8.74227766e-08, -4.37113883e-08)}):Play()
- TweenService:Create(T["Left Hip"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, 0, -0.219999999, -4.37113883e-08, 0, -1, 0, 1, 0, 1, 0, -4.37113883e-08)}):Play()
- TweenService:Create(T["Left Shoulder"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, 0.5, 0, -4.30473115e-08, -7.59040386e-09, -1, -0.173648193, 0.98480773, 0, 0.98480773, 0.173648193, -4.37113883e-08)}):Play()
- wait(animspeed)
- end
- function slide(Timer)
- sliding = true
- TweenService:Create(RootJoint,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, -2, 0, -1, 1.50995803e-07, 0, -5.1643589e-08, -0.342020035, 0.939692676, 1.41889643e-07, 0.939692676, 0.342020035)}):Play()
- TweenService:Create(T.Neck,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(0, 1, 0, -1, 8.21505424e-08, -2.99003418e-08, 0, 0.342020035, 0.939692676, 8.74227766e-08, 0.939692676, -0.342020035)}):Play()
- TweenService:Create(T["Right Hip"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, -1, 0, -1.49501709e-08, 4.10752712e-08, 1, 0.939692676, 0.342020035, 0, -0.342020035, 0.939692676, -4.37113883e-08)}):Play()
- TweenService:Create(T["Right Shoulder"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(1, 0.5, 0, -1.49501709e-08, 4.10752712e-08, 1, 0.939692676, 0.342020035, 0, -0.342020035, 0.939692676, -4.37113883e-08)}):Play()
- TweenService:Create(T["Left Hip"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, 0, -0.5, -4.37113883e-08, 0, -1, 0, 1, 0, 1, 0, -4.37113883e-08)}):Play()
- TweenService:Create(T["Left Shoulder"],TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{C0 = CFrame.new(-1, 0.5, 0, -3.78551732e-08, 2.18556941e-08, -1, 0.5, 0.866025388, 0, 0.866025388, -0.5, -4.37113883e-08)}):Play()
- wait(Timer)
- sliding = false
- end
- Humanoid.Jumping:Connect(function()
- if not wall and not sliding then
- jump()
- end
- end)
- local Tilt = CFrame.new()
- game:GetService("RunService").Heartbeat:Connect(function(Delta)
- if not landing and not jumping and not wall and not sliding then
- local MoveDirection = RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection)
- Tilt = Tilt:Lerp(CFrame.Angles(math.rad(-MoveDirection.Z) * MaxTiltAngle, math.rad(-MoveDirection.X) * MaxTiltAngle, 0), 0.2 ^ (1 / (Delta * 60)))
- RootJoint.C0 = RootC0 * Tilt
- end
- end)
- game:GetService("RunService").Heartbeat:Connect(function(Delta)
- if Humanoid.MoveDirection.Magnitude>0.01 then
- walking = true
- else
- walking = false
- end
- end)
- game:GetService("RunService").Heartbeat:Connect(function()
- if script.Parent.Torso.Velocity.Y > 10 and not landing and not wall and not sliding then -- Are they in the air?
- repeat game:GetService("RunService").Heartbeat:Wait() until script.Parent.Torso.Velocity.Y <= 0 -- When do they land?
- Land()
- end
- end)
- slidetool.Equipped:Connect(function()
- if not sliding then
- local slider = Instance.new("BodyVelocity")
- slider.MaxForce = Vector3.new(1,0,1) * 30000
- slider.Velocity = script.Parent.HumanoidRootPart.CFrame.lookVector * 100
- slider.Parent = script.Parent.HumanoidRootPart
- slide(1)
- slider:Destroy()
- end
- end)
- while wait() do
- if walking and not wall and not sliding then
- RunAnim()
- else
- if not sliding then
- Idle()
- end
- end
- if wall and not sliding then
- climb()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment