Hello, so I am making anime like moves where the player jumps up first but while using LinearVelocity I get this bug where the players also goes it a little to the front.
this is the code for it
if move == "Slam" then
print("fire")
local char = player.Character
local humanoid = char:WaitForChild("Humanoid")
local root = char:WaitForChild("HumanoidRootPart")
Helper.CreateLinearVelocity(root, Enum.VelocityConstraintMode.Vector, root.Position + Vector3.new(0,100,0), math.huge , root, 0.1)
end
CreateLinearVelocity is a function that just creates one and deletes it after the last parameter
I dont think this has anything to do with the vector but just the how its calculated. Thanks for reading and have a nice day.
function Helper.CreateLinearVelocity(attachementParent, Mode, VectorVelocity, Force, parent, lifetime)
if not attachementParent:FindFirstChildWhichIsA("Attachment") then
local Attachment = Instance.new("Attachment")
Attachment.Parent = attachementParent
end
local LinearVelocity = Instance.new("LinearVelocity")
LinearVelocity.VelocityConstraintMode = Mode
LinearVelocity.Attachment0 = attachementParent:FindFirstChildWhichIsA("Attachment")
LinearVelocity.MaxForce = Force
LinearVelocity.VectorVelocity = VectorVelocity
LinearVelocity.Parent = parent or attachementParent
if lifetime and lifetime > 0 then
task.delay(lifetime, function()
if LinearVelocity.Parent then
LinearVelocity:Destroy()
end
end)
end
end```