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?