I am trying to force the player to the direction of the mouse. Everything works perfectly fine other then the fact that it only applies the force when I’m in the air. Here’s a clip:
and here is the script:
local char = plr.Character or plr.CharacterAdded:Wait()
local humRP = char:WaitForChild("HumanoidRootPart")
local vectorForce = Instance.new("VectorForce")
local a1 = Instance.new("Attachment",humRP)
local dif = humRP.Position - mouse.Hit.Position
local direction = Vector3.new(dif.X, 0, dif.Z)
vectorForce.ApplyAtCenterOfMass = true
vectorForce.RelativeTo = Enum.ActuatorRelativeTo.World
vectorForce.Force = direction.Unit * -force
vectorForce.Attachment0 = a1
vectorForce.Parent = humRP
game.Debris:AddItem(vectorForce,forceTime)
game.Debris:AddItem(a1,forceTime)