Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

whats a good way to have a player stay in the same position as the torso after an animation?

Asked by 3 years ago
Edited 3 years ago

you know how when you move the torso in a roblox animation and once its done all the torso moves back to where the hrp is? which doesnt move throughout the animation? im trying to avoid that. im trying to create a system where i use a script to move the hrp through cframe to a position where the character should be facing after an animation is done, and while doing that make it so the torso doesnt move back to the hrp, because im making a combat system and ive been trying to find a solution for 5 MONTHS. im finally turning to you guys becuase i just couldnt find out for the life of me how i can do this. i attempted to place the cframe of the hrp into where the torso is but theres no way to change it so the x and z rotation values are rotated the same way they were before but the y rotation value changes to a place where i can manually change it. i figured out how to MOVE the torso but not ROTATE it correctly. basically i need a way to create a cframe.angles that has the x and z value be the same as what the character is currently in, but the y value able to change independently to the x and z. if somebody knows a way to have the character stay in a position after an animation has stopped you can show me that as well, otherwise improve on the script i put below which is what i tried

explanation for some undefinded variables (this was a part taken out of a larger script so i define the undefined variables here) the click variable here is true for 2 seconds and is set back to false when a player clicks there is debounce on it

the first getmarkerreachedsignal test happens on the last pose of a sword slashing animation i made, and isnt at the end but is on the last pose

the second one is the same case but with the other sword slashing animation that goes after it

test and test2 are animations already loaded onto the humanoid through client and i used humaonid.animator

test:GetMarkerReachedSignal("test"):Connect(function()
    if click == false then return end

    test:AdjustSpeed(0)


    test2:Play()

    repeat wait() until secondCombo == true

    test2:AdjustSpeed(0)

    test:Stop()


    local torsoPos = char.Torso.Position

    local desiredCframe = char.Torso.CFrame

    hrp.CFrame = desiredCframe

    test2:Stop()
end)

test2:GetMarkerReachedSignal("test"):Connect(function()
    secondCombo = true
end)

Answer this question