Smooth parkour vault script

i have improved on a parkour script that was made (not originally by me) so when i press space/jump i vault over it, however its extremely janky and not smooth at all,

local UIS = game:GetService("UserInputService")
local Character = script.Parent
local Root = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")

-- Add a vault animation
local VaultAnimation = Instance.new("Animation")
VaultAnimation.AnimationId = "rbxassetid://128897073877701" -- Replace with your animation ID
local VaultAnimTrack = Humanoid:LoadAnimation(VaultAnimation)

local Params = RaycastParams.new()
Params.RespectCanCollide = true
Params.FilterType = Enum.RaycastFilterType.Exclude
Params.FilterDescendantsInstances = {Character, workspace.CurrentCamera}

UIS.JumpRequest:Connect(function()
	if Humanoid.FloorMaterial == Enum.Material.Air then
		return
	end

	-- Perform raycasts for the vault detection
	local VaultCastHead = workspace:Raycast(Character.Head.CFrame.Position + Vector3.new(0, -.5, -.5), Root.CFrame.LookVector * 5, Params)
	local VaultCast = workspace:Raycast(Root.CFrame.Position + Vector3.new(0, -.5, 0), Root.CFrame.LookVector * 3.5, Params)

	if VaultCastHead then
		return
	end

	if not VaultCast then
		-- Normal jump
		Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
		return
	end

	-- Vaulting logic
	Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false) -- Disable normal jumping

	-- Set the obstacle to non-collidable
	VaultCast.Instance.CanCollide = false

	-- Play vault animation
	VaultAnimTrack:Play()

	-- Physics-based vaulting motion
	Root.AssemblyLinearVelocity = Root.CFrame.LookVector * 50 + Vector3.new(0, 5, 0) -- Adjust speed for smoother vaulting

	-- Wait for the duration of the vault
	task.wait(0.8) -- Adjust the wait time to match the animation length

	-- Restore obstacle collision
	VaultCast.Instance.CanCollide = true

	-- Re-enable jumping
	Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
end)

1 Like

im trying to make it like parkour reborns vault, any tips?

When player is vaulting set the workspace.Gravity to 0 and when player stops vaulting set it back as it was.

thank you for responding, how would i implement this into my script?

When you start your vaulting change it to 0 and when finish change it back to old as it was:

local UIS = game:GetService("UserInputService")
local Character = script.Parent
local Root = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")
local oldgravity = workspace.Gravity

-- Add a vault animation
local VaultAnimation = Instance.new("Animation")
VaultAnimation.AnimationId = "rbxassetid://128897073877701" -- Replace with your animation ID
local VaultAnimTrack = Humanoid:LoadAnimation(VaultAnimation)

local Params = RaycastParams.new()
Params.RespectCanCollide = true
Params.FilterType = Enum.RaycastFilterType.Exclude
Params.FilterDescendantsInstances = {Character, workspace.CurrentCamera}

UIS.JumpRequest:Connect(function()
	if Humanoid.FloorMaterial == Enum.Material.Air then
		return
	end

	-- Perform raycasts for the vault detection
	local VaultCastHead = workspace:Raycast(Character.Head.CFrame.Position + Vector3.new(0, -.5, -.5), Root.CFrame.LookVector * 5, Params)
	local VaultCast = workspace:Raycast(Root.CFrame.Position + Vector3.new(0, -.5, 0), Root.CFrame.LookVector * 3.5, Params)

	if VaultCastHead then
		return
	end

	if not VaultCast then
		-- Normal jump
		Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
		return
	end

	-- Vaulting logic
	Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false) -- Disable normal jumping

	-- Set the obstacle to non-collidable
	VaultCast.Instance.CanCollide = false
	
	workspace.Gravity = 0
	
	-- Play vault animation
	VaultAnimTrack:Play()

	-- Physics-based vaulting motion
	Root.AssemblyLinearVelocity = Root.CFrame.LookVector * 50 + Vector3.new(0, 5, 0) -- Adjust speed for smoother vaulting

	-- Wait for the duration of the vault
	task.wait(0.8) -- Adjust the wait time to match the animation length

	-- Restore obstacle collision
	VaultCast.Instance.CanCollide = true

	-- Re-enable jumping
	Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
	workspace.Gravity = oldgravity
end)
1 Like


thanks so much for responding, i have a slight problem, here is a video as a demonstration

1 Like

Split the wait time and put the gravity line in between:

task.wait(0.4)
workspace.Gravity = oldgravity
task.wait(0.4)
1 Like

this worked! thank you so much for your help!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.