Put the code in startercharacterscripts
local UIS = game:GetService("UserInputService")
local Character = script.Parent
local Root = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")
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
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
Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
return
end
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,false)
VaultCast.Instance.CanCollide = false
Root.AssemblyLinearVelocity = Root.CFrame.LookVector * 90 + Vector3.new(0,5,0)
task.wait(.2)
VaultCast.Instance.CanCollide = true
end)