BodyPosition Properties Won't Update By Script

Hey All,

I’m having trouble getting the BodyPosition properties to update when a Script runs. Some insight on what I should change would be much appreciated.

Here’s a basic setup:

  • New game with baseplate.
    -1 block on one end, anchored, called Target.
    -A second block on the other end, not anchored, called Part.
    -Inside the second block add a BodyPosition
    - Set MaxForce to: 1000, 1000, 1000
    - Set P to: 1000
  • Also add a Script in the Part block (for moving the Part)
  • Add another Script in the Part block (for changing the MaxForce and P values of BodyPosition)

Here is the Script to move the Part towards the Target:

wait(.1)
local orientationPoint = script.Parent
local bodyPosition = script.Parent.BodyPosition
local target = game.Workspace.Target

while true do
     local targetPosition = target.Position
     bodyPosition.Position = targetPosition
     orientationPoint.CFrame = CFrame.new(orientationPoint.Position, target.Position) * CFrame.Angles(math.pi * -0.5, 0, 0)

     wait(.01)
end

Here is the Script for changing the BodyPosition Values:

local bodyPosition = script.Parent.BodyPosition

local maxForce = bodyPosition.MaxForce
local power = bodyPosition.P

wait(1)

maxForce = Vector3.new(5000,5000,5000)
power = 5000

print("Power value in the script is: " .. power)
print("Power value of the BodyPostion is " .. script.Parent.BodyPosition.P)

--End

My goal is to have the part move at a slower speed for 1 second, then speed up afterwards, according to the new MaxForce and Power values. The problem is the values don’t change for BodyPosition.

Any thoughts?

If you need that part goes to player, you can use RocketPropulsion

How to use:

game.Workspace.Part.RocketPropulsion.Target = Target
wait(5)
game.Workspace.Part.RocketPropulsion:Fire()

Or, if your part doesnt move, you can up MaxForce

The part moves, but it won’t change its speed to go faster. After 1 second I have the MaxForce and P increase in the Script to make the part go faster, but it doesn’t. I notice the BodyPosition values never changed and I don’t know why.

Here is a copy of that basic setup game to try out, if desired.

BodyPositionTest.rbxl (23.2 KB)

Try add BodyVelocity with RocketPropulsiom and change velocity in BodyVelocity (velocity - speed)

This is the first time I’m using these BodyMover options. I read the page about RocketPropulsion and incorporated RocketPropulsion instead of BodyPosition. RocketPropulsion is working well so far. I was able to change the object speed after a few seconds using a Script. Thanks!

1 Like