Player not moving properly with vector force

  1. What do you want to achieve?
    I want it where while the player clicks a part, the player gets pulled towards that part.

  2. What is the issue?
    The character is not creating enough force to lift the player off the ground unless the player jumps, and has weird interactions with the ground.

  3. What solutions have you tried so far?
    I have tried using .velocity on the root part of the player to move the player. I have also tried increasing the speed multiplier to be able to lift the player off the ground, but once the player is off the ground it moves way faster than desired.

HRP is the player’s root part, part is what is clicked. 10.8 is the estimated character’s mass.

	local vForce = Instance.new("VectorForce")
	vForce.Parent = HRP
	local Attach = Instance.new("Attachment")
	Attach.Parent = HRP
	vForce.Attachment0 = Attach
	vForce.RelativeTo = Enum.ActuatorRelativeTo.World
	vForce.ApplyAtCenterOfMass = true
	
	
	game:GetService("RunService").Heartbeat:Connect(function(dt)
		
		local targetVel = (part.Position - HRP.Position).Unit * Speed
		print(targetVel)
		local acceleration = targetVel - HRP.Velocity
		print(acceleration)
		vForce.Force = 10.8 * acceleration
	end)

Maybe try multipying it with workspace.Gravity as well?

or try reviewing this solution on another post… (even though you are using vector force but you’ll probably get some cues to solve it)

1 Like