How to make a Vault System like Dead by Daylight

Hi! I wanted to make a vault system just like in Dead by Daylight where the player presses an input when they get close to a vault object. When a player presses the vault prompt the player’s character will be locked in place during the vaulting animation and they will end up in the other side of the vault object.

I already made a system like this, but it uses TweenService to tween the HumanoidRootPart of the player for the vault movement, although it doesn’t look nice or something close to Dead by Daylight’s.

What I want to achieve is something like in this game called Bully Michael Myers:
https://streamable.com/qnti7i

When you press the vault prompt even if you’re a little bit far away, your character’s position is sucked near the vault position and is locked in place during the animation.

I was wondering if you guys can help me replicate whatever is going on here? Do I also have to use TweenService or something? Please and thanks.

From what I can understand, what is happening with the outcome you’re after is:

  1. A prompt for the interaction
  2. An animation plays, preventing any other player movement or action
    2.1. The player is tweened horizontally and vertically(?) as the animation plays
  3. When the animation finishes, the player is placed in a new location
    3.1 The player’s CFrame may be moved into the new position after the animation

Since you have tried making one before, these suggestions can possibly help you

1 Like

Ok I tried making my own vault system using your suggestions, but it looks weird and not remotely close to the example video:

My vault system

I used tween service to tween the HumanoidRootPart, but the character just looks like it’s floating to the other end position of the vault. How can I make it so that the vault animation is locked in place and that the character’s position is only updated to the end of the vault position when the vault animation is over?

1 Like

I would lock the player facing towards the object first, then remove the lock it once the animation is finished. Since it also appears to be the feature where your avatar’s head locks with the camera, I would disable it until the vault is completed.

You’re making good progress, loving it so far.

1 Like

how do you lock the player facing towards the object? I’m still an intermediate lua coder, but I can’t figure it out.

I assumed it was something you made because my R15 game doesn’t have it.

1 Like

Yeah no, the video from my post was not made by me. I just wanted to achieve something similar to that.

vault.wmv (1.6 MB)
This is a video of the vault system.

Ive uncopylocked the place so you can see it and use it
Vault System - Roblox

This is the script:


local ve = script.Parent
local prox = ve.ProximityPrompt
local goal = ve.goal


local TS = game:GetService("TweenService")


prox.Triggered:Connect(function(player)
	
	local Animator = player.Character.Humanoid.Animator
	local HumanoidRootPart = player.Character.HumanoidRootPart
	local info = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false) 
	HumanoidRootPart.Anchored = true
	local tween = TS:Create(HumanoidRootPart, info, {CFrame = goal.CFrame})
	tween:Play()
	
	tween.Completed:Connect(function()
		HumanoidRootPart.Anchored = false
	end)
	
	local loadAnimation = Animator:LoadAnimation(ve.vaultAnim)
	loadAnimation.Priority = Enum.AnimationPriority.Action4
	loadAnimation:Play()
	loadAnimation:AdjustSpeed(1/loadAnimation.Speed)
end)

This is just the base of the vault system. There are some problems with the proximity prompt as you can press the one on the other side of the block.
This is just to get you started.

Explanation:
The humanoidrootpart is anchored so the camera doesnt shake around and so the character is in place. The cframe of the humanoidrootpart is tweened to where the goal cframe is. An animation is played that lasts 1 second, equal to the time it takes for the tween

1 Like

Hold up I messed up you want the vault from the first video. Let me revise, sorry

Uncopylocked place:
Vault System - Roblox

Video:
vault2.wmv (1.7 MB)

Script:

local ve = script.Parent
local prox = ve.ProximityPrompt
local goal = ve.goal
local lock = ve.lockPosition


local TS = game:GetService("TweenService")


prox.Triggered:Connect(function(player)
	local HumanoidRootPart = player.Character.HumanoidRootPart
	HumanoidRootPart.Anchored = true
	local Animator = player.Character.Humanoid.Animator
	local crossInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false) 
	local lockInfo = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false) 
	local LockTween = TS:Create(HumanoidRootPart, lockInfo, {CFrame = lock.CFrame})
	local CrossTween = TS:Create(HumanoidRootPart, crossInfo, {CFrame = goal.CFrame})
	
	LockTween:Play()
	task.wait(0.2)
	CrossTween:Play()
	
	CrossTween.Completed:Connect(function()
		HumanoidRootPart.Anchored = false
	end)
	
	local loadAnimation = Animator:LoadAnimation(ve.vaultAnim)
	loadAnimation.Priority = Enum.AnimationPriority.Action4
	loadAnimation:Play()
	loadAnimation:AdjustSpeed(1/loadAnimation.Speed)
end)

The player is anchored and a tween is used to get the player into starting position to get ready for the vault, and the second tween is the vault.

Sometimes it may look like the player is phasing through the wall. You can just adjust the animation to make it look natural.

The goal is where the vault goes and the yellow cyclinder is the direction the player goes in while vaulting.

This is just the base of the system, there are problems with the proximity prompt such as you being able to spam them and pressing them through walls.

Feel free to ask questions, I hope this is what you are looking for!

2 Likes

Wow thanks a bunch dude! I’ve pretty much had the base code similar to this, but not quite. Thank you for answering and hopefully other people will also get help from this post :smiley: