Main question: For a successful roll, do I need to use body gyro/velocity or is there another feature that I can add?
Background: I have a tool that triggers a roll animation on click, and the code of the tool is not the problem, the animation is. The roll sends the player a few feet in front of them however I understand that animations do not change the player’s position, as when it is over it resets the player to the position they were in before. Would I have to use body gyro and velocities on the player or is there a way where the animation can actually change the player’s position?
Links, critique, and any other information is deeply appreciated.
I dont think animations can change a players position, it only changes the position then resets to the original position. Just add a bodyvelocity and delete it after x amount of time. Another way is to change the CFrame of the player’s HumanoidRootPart(Torso if its r6) by adding to it.
site for BodyVelocity : https://developer.roblox.com/api-reference/class/BodyVelocity)
Youtube video for BodyVelocity: (https://www.youtube.com/watch?v=7JzLaYktaI0)
You could do something like this for Body Velocities:
1 | local bv = Instance.new( "BodyVelocity" ,script.Parent.HumanoidRootPart) |
2 | bv.MaxForce = Vector 3. new( math.huge , math.huge , math.huge ) -- ensures that the player wont be pushed away by other objects |
3 | bv.Velocity = script.Parent.HumanoidRootPart.CFrame.lookVector* 100 |
4 | wait( 1 ) |
5 | bv:Destroy() |
In my opinion, Cframes are harder than BodyVelocities . However, if you wanted to use Cframes, you would add a Vector3 value to the current CFrame.
Hope this helps! Sorry for my crappy explanations