Im making a pallet dropping and vaulting system the animation and teleporting work fine individually but they aren’t working well together
heres a video showing my issue
at first i thought the issue had to do with how I was teleporting the player after the animation ended which caused the weird character floating so I tried adding a keyframe event to teleport a few frames before the animation completed but that didnt work out. heres my code
local function onPalletVault(player : Player, pallet : Model)
local char = player.Character
local hum = char.Humanoid
Remotes.Controls:FireClient(player, false)
pallet.slowVault.CanCollide = false
local lookAt = CFrame.lookAt(char.HumanoidRootPart.Position, pallet.palletDropHitBox.Position)
local side, newCf = closerCFrame("smaller", pallet:GetAttribute("Left"), pallet:GetAttribute("Right"), char:GetPivot())
-- Code below is supposed to force the character to face the pallet before vaulting works on its own but with the animation and teleporting decides not to work will fix this later
player.Character.HumanoidRootPart.CFrame = newCf
char:PivotTo(lookAt)
-- Gets the side and CFrame of the side
local sideToTeleport, cFrametoTeleport = closerCFrame("bigger", pallet:GetAttribute("Left"), pallet:GetAttribute("Right"), char:GetPivot())
local track = hum:LoadAnimation(palletVaultAnim:FindFirstChild(sideToTeleport))
track:Play()
track:GetMarkerReachedSignal("canShockStart"):Connect(function()
player:SetAttribute("canShock", true)
end)
track:GetMarkerReachedSignal("canShockEnd"):Connect(function()
player:SetAttribute("canShock", false)
end)
track:GetMarkerReachedSignal("dismount"):Connect(function()
player.Character.HumanoidRootPart.CFrame = cFrametoTeleport
Remotes.Controls:FireClient(player, true)
end)
end
i was using PivotTo to teleport the player but it didn’t want to teleport in the right places for some reason
heres a video showing what happens when I use PivotTo instead of player.Character.HumanoidRootPart.CFrame = cFrametoTeleport
might be related not sure any help is greatly appreciated
First off, you can user either tweens or smoothdamping to make teleporting the player to the correct position of the pallet smooth.
To fix the vaulting animation, you can try to either instantly teleport the player to the other side of the pallet then play the animation which will have to be adjusted so the player appears to be vaulting it smoothly rather than jolting.
Or you can do what I did with my old dbd game of which I just tweened the players hrp cframe to the other side of the pallet. The former method would be more performant so you should probably do that.
this sounds like it could work but when would I play the tween? before or after because it doesnt become smooth since the code runs in order from playing the animation before tweening or tweening before the animationis there someway I have to figure out to make it run parallel with the animation?
i forgot animations replicate on the server but wouldn’t I have to fire a remote for every keyframe event?
I still want my players to be hit while their vaulting tho
basically i just need to do the teleporting and animations on the client and it works fine. i will have to use remotes quite a lot which I dont like but its the only way
this solved the weird character floating thing but I teleports the character a little bit farther for some reason ill try out the rootmotion module since thats exactly what i need
That’s because when an animation stops, it already has a fade time (which is the number in the stop solution i gave you) if you put stop right before the animation ends, it ends that animation without any fade time. if you don’t put it, it’ll probably cause that floating issue you had earlier. (Or you still have)