I’m making a roll and using VectorForce to do it, issue is that it’s wayyy too buggy and changes constantly. For example when I roll on the ground it pushes me forward fine, but when I roll in the air it pushes me way further than when I was on the ground, or when I roll with a tool it makes me travel significantly shorter than if I were to roll normally. I need an alternative.
The script is client-side & is in StarterCharacterScripts.
uis = game:GetService('UserInputService')
char = script.Parent
hrp = char:WaitForChild("HumanoidRootPart")
canRoll = true
if isTyping or canRoll == false then return end
if input.KeyCode == Enum.KeyCode.Q then
canRoll = false
local vel = Instance.new('VectorForce', hrp)
local attach = Instance.new('Attachment', hrp)
vel.Name = "RollForce"
attach.Name = "RollAttachment"
vel.Attachment0 = attach
vel.RelativeTo = Enum.ActuatorRelativeTo.World
vel.Force = hrp.CFrame.LookVector*15000
canRoll = true
Edit: I am willing to use VectorForce if there is a way of making it less buggy.
There should be an alternative way for doing this. So my idea is, you can use ContextActionService that binds with your roll mechanic. Once it runs, you lerp HumanoidRootPart forwards to where the player is facing using CFrame. At the same time, you create a rolling animation. You can add some debouncing value to make sure that the player cannot reroll when they are already rolling.
I don’t recommend you to use any bodyMovers for this type of thing, as you can tell it’s less reliable and can vary sometimes. I made a similar system recently, what I did was just offsetting the character’s HumanoidRootPart CFrame by a specific amount inside a for loop. This way it’s not dependant on physics. Then you can use raycasting to check if the player is close to a wall and stop before they go through. Hope it helps!