I’m trying to make a dunk, and the problem happens when I tried scripting player’s movement. The LinearVelocity just don’t seem to be acting what I thought it should be. I also spawned a little brick there, as a reference. Here’s the script.
local m = c.Model
local HRP = c.HumanoidRootPart
local v = Instance.new("LinearVelocity",HRP)
v.Attachment0 = HRP.RootRigAttachment
v.VelocityConstraintMode = Enum.VelocityConstraintMode.Line
v.MaxForce = 18000
v.LineDirection = HRP.CFrame.LookVector
v.LineVelocity = 20
wait(.3)
v.Enabled = false
v.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
v.MaxForce = 900
spawn(function()
local p = Instance.new("Part",workspace)
p.Color = Color3.fromRGB(255,0,0)
p.Position = HRP.CFrame*CFrame.new(0,5,-50).Position
p.CFrame = CFrame.new(p.Position,c.HumanoidRootPart.CFrame.LookVector)
p.Anchored = true
p.CanCollide = false
end)
v.VectorVelocity = HRP.CFrame*CFrame.new(0,5,-50).Position
wait(.1)
v.Enabled = true
wait(.4)
v.Enabled = false
I am having my owns problems with LinearVelocity, but I don’t know if this will help your case. Instead of “v.VectorVelocity = HRP.CFrame * CFrame.new(0,5,-50).Position” my idea would be to put “v.VectorVelocity = CFrame.new(HRP.Position,(HRP.CFrame * CFrame.new(0,5,-50)).Position).lookVector*50”