How on earth would I create sliding like in Caliber?

I have sliding in a game but the owner wants it to be specifically like Caliber


How would I make it like that?

The part I want to replicate is when you can look around while sliding.

My code:

local function slide()
	local dir = char.HumanoidRootPart.CFrame:VectorToObjectSpace(char.Humanoid.MoveDirection)
	sliding = true
	local a = 0.1875/3
	while wait() do
		local ray = Ray.new(char.HumanoidRootPart.CFrame.Position, (char.HumanoidRootPart.CFrame*CFrame.new(0,0,-1).Position - char.HumanoidRootPart.CFrame.Position).unit * 3)

		local part, position,normal = workspace:FindPartOnRayWithIgnoreList(ray, ig, false, true)
		if not part then
			if a > 0.01875/6 then
				a-=0.01875/6
				if dir ~= Vector3.new(0,0,0) then
					local dir2 = char.HumanoidRootPart.CFrame:VectorToObjectSpace(char.Humanoid.MoveDirection)
					char.HumanoidRootPart.CFrame *= CFrame.new(dir*a) * char.HumanoidRootPart.CFrame.Rotation
				else
					game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 14 
					sliding = false
					if running then
						local TweenService = game:GetService("TweenService")
						local TweenInformation = TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0)
						local Tween = TweenService:Create(script.RunCF, TweenInformation, {Value = statmodule.RunCF}):Play()
					end
					--char.HumanoidRootPart.CFrame *= CFrame.new(0,0,-a) -- hell naw bro you aint sliding unless you BUISHJGHJF
					break
				end
			else
				a = 0
				game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 14
				crouching = false
				sliding = false
				if running then
					local TweenService = game:GetService("TweenService")
					local TweenInformation = TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0)
					local Tween = TweenService:Create(script.RunCF, TweenInformation, {Value = statmodule.RunCF}):Play()
				end
				local TweenService = game:GetService("TweenService")
				local TweenInformation = TweenInfo.new(0.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out, 0, false, 0)
				local Tween = TweenService:Create(char.Humanoid, TweenInformation, {CameraOffset = Vector3.new(0,0,0)}):Play()
				break
			end
		else
			game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 14
			print(part.Name)
			crouching = false
			sliding = false
			local TweenService = game:GetService("TweenService")
			if running then
				local TweenService = game:GetService("TweenService")
				local TweenInformation = TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0)
				local Tween = TweenService:Create(script.RunCF, TweenInformation, {Value = statmodule.RunCF}):Play()
			end
			local TweenInformation = TweenInfo.new(0.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out, 0, false, 0)
			local Tween = TweenService:Create(char.Humanoid, TweenInformation, {CameraOffset = Vector3.new(0,0,0)}):Play()
			break
		end
		if falling then
			game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 14
			crouching = false
			sliding = false
			if running then
				local TweenService = game:GetService("TweenService")
				local TweenInformation = TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0)
				local Tween = TweenService:Create(script.RunCF, TweenInformation, {Value = statmodule.RunCF}):Play()
			end
			break
		end
	end
end
2 Likes