#Vaulting system

1 messages · Page 1 of 1 (latest)

spiral garden
#

Hiiii! I’m making a game and really want to add a vaulting thing where the player can jump out windows and stuff but I literally don’t know hoooow! I’ve tried tutorials and using the ai in the studio and I just can’t get it to work if find anyone that can teach me how to do it. Can someone PLEASE help! I just need to learn how to make the player literally vault over a block with an animation I will create and that’s it! Any help will be REALLY appreciated 😇

stone ingot
#

How much do you know when it comes to Lua

rose ivy
sweet raftBOT
#

studio** You are now Level 1! **studio

rose ivy
#

You can manipulate the player position and camera effects to make it more dynamic.

spiral garden
spiral garden
# rose ivy Learn animations first, then trigger the animation and play it when the player t...

Okay PERF I got that set now ty! It didn’t work earlier I don’t know why, but how do I make it so that the player actually goes across the “wall”? Bcs when I click the proximity button and the animation plays, since the wall is set to collidable, the player doesn’t go across and just kind of like gets pushed back. And I can’t set it to non collidable because that kind of defeats the whole purpose of it

#

And this isn’t as important I’m sure I can figure it out but do u or anyone else know how I can make it so that when the player clicks the proximity prompt it like freezes them and puts them in front of the wall so the anim actually works?

sweet raftBOT
#

studio** You are now Level 1! **studio

wraith zenith
#

im guessing u can anchor the humanoidRootPart but that wont get the player infront of the wall

#

maybe spam set its cframe to that of the torsp

spiral garden
#

OMG YESSSS IT TOTALLY WORKED! TYSM!

spiral garden
#

It’s like the last thing I need to finish this whole thing I think

#

Wait actually there’s something else

spiral garden
#

Like this is the situation

wraith zenith
#

detect which side the player is in

#

like if u add a while to the lookvector, will the player turn out in this area?

#

if not, then its the opposite side

spiral garden
#

OMG U HELPED ME DISCOVER IT THX!

#

I added a thing called dot I think and then that sees where the player is facing and depending on the side it vaulted the other way!

#

Ty I appreciate it!

spiral garden
#

If anyone knows how to make it so that the character actually goes to the other side and doesn’t go back to the original spot please tell me!

wraith zenith
#

can u show me the animation?

#

not the completed thing

#

in the editor

#

or ill just tell you

spiral garden
#

Wdym?

sweet raftBOT
#

studio** You are now Level 2! **studio

wraith zenith
#

right when the animation ends; add an animation event. if your using the builtin animation editor, make sure to set both fields to a name

#

the same name

spiral garden
#

Ohhh wait I think I know what u mean

#

Let me try it

wraith zenith
# spiral garden Let me try it

then, atfer the anim:Play() insert

anim:GetMarkerReachedSignal("AnimEnd"):Connect(function() -- replace "animend" with the animation event name
    character.HumanoidRootPart.Position = character.Torso.Position -- ofcourse you need to replace 'character' with the player character's path
end)```
spiral garden
#

This is the script I have

#

local ProximityPrompt = script.Parent
local wall = script.Parent.Parent
local AnimationId = "rbxassetid://myanimation" -- Vault animation with event

ProximityPrompt.Triggered:Connect(function(player)
if not player or not player.Character then
return
end

-- 🕒 Temporarily disable prompt
ProximityPrompt.Enabled = false
task.delay(3, function()
    ProximityPrompt.Enabled = true
end)

local character = player.Character
local humanoid = character:FindFirstChildOfClass("Humanoid")
local hrp = character:FindFirstChild("HumanoidRootPart")
if not humanoid or not hrp then
    return
end

-- Freeze the player
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0

-- 🧠 Calculate vault direction BEFORE rotating player
local wallLook = wall.CFrame.LookVector
local directionToPlayer = (hrp.Position - wall.Position).Unit
local dot = wallLook:Dot(directionToPlayer)
local directionMultiplier = dot > 0 and 1 or -1
local vaultDirection = wallLook * directionMultiplier

-- Move player in front of the wall based on side
local distanceFromWall = 2
local vaultPosition = wall.Position + vaultDirection * distanceFromWall
local lookAtWall = CFrame.new(vaultPosition, wall.Position)
hrp.CFrame = lookAtWall

task.wait(0.1)

-- Create and load animation
local animation = Instance.new("Animation")
animation.AnimationId = AnimationId

local animator = humanoid:FindFirstChildOfClass("Animator")
local track
if animator then
    track = animator:LoadAnimation(animation)
else
    track = humanoid:LoadAnimation(animation)
end

if track then
    track:Play()
#

-- 🔁 Move player when animation event "VaultOver" is reached
track:GetMarkerReachedSignal("VaultOver"):Connect(function()
local vaultDistance = 4 -- Adjust if needed
hrp.CFrame = hrp.CFrame + vaultDirection * vaultDistance
end)
end

-- Unfreeze after animation ends
task.delay(3, function()
    humanoid.WalkSpeed = 16
    humanoid.JumpPower = 50
end)

end)

#

I’ve been trying to tweak it for like an HOUR and everything works except the part where it’s supposed to take the player to the other side

#

😭😭

#

-- 🔁 Move player when animation event "VaultOver" is reached
track:GetMarkerReachedSignal("VaultOver"):Connect(function()
local vaultDistance = 4 -- Adjust if needed
hrp.CFrame = hrp.CFrame + vaultDirection * vaultDistance
end)
end

spiral garden
spiral garden
wraith zenith
sweet raftBOT
#

studio** You are now Level 7! **studio

wraith zenith
#

i was asleep 😭

#

also can y'all PLEASE type your code like this
```lua
(code here)
```
ITS SO HARD TO READ >:(

#

did you try subtracting it instead?
hrp.CFrame = hrp.CFrame - vaultDirection * vaultDistance
i can see the character moves backwards in both cases
so just subtract instead of adding it

wraith zenith
#

ummm

#

ummm

wraith zenith
#

wake up

spiral garden
#

It’s okay dw 😇

spiral garden
#

Okay well I don’t know if that worked bcs like I said in my other post, the character like slooowly stops working and I suspect it’s something other than the script and it’s so annoying 😔

#

Actually maybe that doesn’t work because now I can only vault on one side…

wraith zenith
#

you changed it to

hrp.CFrame = hrp.CFrame - vaultDirection * vaultDistance

???

#

maybe add parentheses

#

hrp.CFrame = hrp.CFrame - (vaultDirection * vaultDistance)

wraith zenith
#

its supposed to work when subtracting

wraith zenith
sweet raftBOT
#

studio** You are now Level 3! **studio

spiral garden
spiral garden
#

It only made the vaulting stop working faster

spiral garden
spiral garden
#

TEARDROP SOMEONE JUST TOLD ME HOW TO FIX IT BUT THANK YOU SOSO MUCH FOR EVERYTHING I GENUINELY COULDNT HAVE GOTTEN THIS FAR WITHOUT U 🫶🫶🫶

wraith zenith
#

send a link