So I am making a game where a player needs to dive into a pit, and I want to overwrite the regular falling animation with new one where you dive straight downwards. This is the script I have now:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Animate") then
hit.Parent:WaitForChild("Animate"):WaitForChild("fall"):WaitForChild("FallAnim").AnimationId = "rbxassetid://107061698037112"
end
end)
The script is inside an invisible part that you hit just when diving into the pit, but the problem is that you are already falling once you hit the part, and the animation won’t update the current falling one (you would keep falling in the regular roblox falling animation). I can’t really set the animation by default because it would be weird if people jumped like that in the spawn area. I tried just looping the animation once you fell (even though I want all the other animations still to play, like the idle and running animation because the game is not only falling) and then I discovered that the animation kinda auto aligned with the falling, so it would never dive straight downwards and align you to just skydive-fall, changing the animation’s orientation did not work as well.
Btw I know updated the script so that it would play the animation when touching the green block (the transparent green block is the part that will swap the animationIds), the script used here was:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Animate") then
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://107061698037112"
Anim.Parent = hit.Parent
hit.Parent:WaitForChild("Humanoid"):LoadAnimation(Anim):Play()
end
end)