BodyPosition doesn't affect the part

Hello developers! So I am working on my horror game and I use BodyPosition for my AI, this is my quick module that I made, but the character doesn’t seem to work, or BodyPosition doesn’t affect the part, here’s my module :

local module = {}

module.__index = module
module.__moveToFinishedEvent ="BindableEvent")
module.MoveToFinished = module.__moveToFinishedEvent.Event
module.speed = 16
module.speedIncrement = 100

	repeat task.wait() until (script.Parent.BodyPosition.Position - script.Parent.Position).Magnitude < 1

	local realSpeed = math.clamp((script.Parent.Position - script.Parent.BodyPosition.Position).Magnitude - module.speed,math.round(module.speed / 4),module.speed)
	script.Parent.BodyPosition.MaxForce = * module.speedIncrement,realSpeed * module.speedIncrement,realSpeed * module.speedIncrement)

function module:MoveTo(position : Vector3)
	if not position then return end
	script.Parent.BodyPosition.Position = position

return module
1 Like

The part may be anchored, or be welded to an anchored part, otherwise it may be a problem with the :MoveTo() function.

No, part is unanchored and It isn’t welded to any part, it just falls into void. As it has normal physics.

Try setting max force to (inf, inf, inf) and see if it works. If so, not enough force.

Somehow it fixed itself. Maybe it was of wrong force setting.

1 Like