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.
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.
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?
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.
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
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