I’m making a kick system where you can kick another player that you are paired with. My issue is that I can’t figure out how to make the Linear Velocity head straight where the other player was facing. The power is perfect and works as expected it just always goes in the exact same direction even when the player kicking does different angles.
Problem is on the line where I assign the linearVelocitys VectorVelocity.
local function kick(player, otherPlayer)
local IsPaired = ServerStorage.Functions.CheckPair:Invoke(player, otherPlayer)
if IsPaired == true then
if not table.find(Debounce, player.UserId) then
table.insert(Debounce, player.UserId)
local character = player.Character or player.CharacterAdded:Wait()
local otherCharacter = otherPlayer.Character or otherPlayer.CharacterAdded:Wait()
local linearVelocity = Instance.new("LinearVelocity", character:FindFirstChild("HumanoidRootPart"))
local attachment = Instance.new("Attachment")
attachment.Parent = character:FindFirstChild("HumanoidRootPart")
linearVelocity.Attachment0 = attachment
linearVelocity.MaxForce = math.huge
linearVelocity.VectorVelocity = otherCharacter.HumanoidRootPart.CFrame.LookVector + Vector3.new(0, 100, -100)
task.wait(0.5)
linearVelocity:Destroy()
local index = table.find(Debounce, player.UserId)
table.remove(Debounce, index)
end
end
end
what you’re doing here is adding a flat amount to set axes (Y and Z) to the velocity, so the velocity will always go to the Y and Z direction. linearVelocity.VectorVelocity = otherCharacter.HumanoidRootPart.CFrame.LookVector + Vector3.new(0, 100, -100)
instead, like Planet said above, you should be multiplying the lookvector, so the velocity is increased by 100.