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

Roll animation that changes player position?

Asked by 5 years ago

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.

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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:

local bv = Instance.new("BodyVelocity",script.Parent.HumanoidRootPart)
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)-- ensures that the player wont be pushed away by other objects
bv.Velocity = script.Parent.HumanoidRootPart.CFrame.lookVector*100
wait(1)
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

0
Thank you very mcuh!! Bgonzalezseeya11 27 — 5y
Ad

Answer this question