I’d like to move the characters into the ending position after the animation is complete, as we know usually they just return to the starting position because that’s where the HRP is.
I’ve looked around Google and the developer hub, the current script I have is the closest thing to it working. I’ve tried the following:
Stuff like MoveTo:(), PivotTo:() and what you can see in the script.
The ideal scenario would be to take the position of every single part of the model and set the position to that all while putting the HRP into the proper location, obviously, I am not sure if that is possible because there are multiple parts inside of the model.
animHandler.OnServerInvoke = function(plr,enemy)
local mainChar = plr.Character
---remember where i said the stud part is important well here it is, it position the character by making it face the dummy and make the dummy face you then put its position relatively 5 stud away from you so that it can play the animation properly and perfectly
mainChar.HumanoidRootPart.CFrame = CFrame.new(mainChar.HumanoidRootPart.Position,Vector3.new(enemy.HumanoidRootPart.Position.X,mainChar.HumanoidRootPart.Position.Y,enemy.HumanoidRootPart.Position.Z)) ---make plr face the dummy
enemy.HumanoidRootPart.CFrame = mainChar.HumanoidRootPart.CFrame * CFrame.new(0,0,-1) -- position the dummy to teleport to 5 stud from you
enemy.HumanoidRootPart.CFrame = CFrame.new(enemy.HumanoidRootPart.Position,Vector3.new(mainChar.HumanoidRootPart.Position.X,enemy.HumanoidRootPart.Position.Y,mainChar.HumanoidRootPart.Position.Z)) ---make dummy face the plr
local Animation1 = mainChar.Humanoid:LoadAnimation(animationFolder.Headslam) ---the player animation
local Animation2 = enemy.Humanoid:LoadAnimation(animationFolder.Headslammed) ----the enemy animation
task.wait(.1) ----this is optional i am making the script to wait just so both animation can load
Animation1:Play()---play both of the animation
Animation2:Play()
local connection = Animation1.KeyframeReached:Connect(function(keyName)
if keyName == "EndKeyFrame" then
Animation1:AdjustSpeed(0)
mainChar.HumanoidRootPart.CFrame = mainChar.UpperTorso.CFrame
end
end)
local connection = Animation2.KeyframeReached:Connect(function(keyName)
if keyName == "EndKeyFrame" then
Animation2:AdjustSpeed(0)
mainChar.HumanoidRootPart.CFrame = mainChar.UpperTorso.CFrame
end
end)
return true ---returning a true to the client
end```
https://gyazo.com/b137a65b29842b845e8858e456a4944e
https://gyazo.com/d06eb6fcdc420622c11d508bc5d0b15d
The current method I'm using seems to have messed up the syncing aswell, before trying anything both animations played in sync.
I've included a gif of what I have and what my desired result, I am trying to make a fighting game, if you know any method to get the desired result, even if it is "off topic" (moving characters after an animation is complete) please share.
Thanks!