Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make a part "update" to a new BodyPosition?

Asked by 4 years ago

I have a script that changes a parts bodyposition.Position, but the part isn't moving to the new position. With that, the part starts working if you move it/"Update" it with the move tool while playing in the editor.

Here's the script in case it's the problem:

brick = script.Parent --find brick
startposition= brick.Position
bpos = brick:WaitForChild("BodyPosition") --find bodyposition
bpos.Position = brick.Position --set position automatically

startpos = brick.Position --set start position

Instance.new("BodyGyro",brick)

script.Parent.Anchored = false

--movement
while wait(brick.time.Value) do
    bpos.Position = startposition+ brick.direction.Value
    wait(brick.time.Value)
    bpos.Position = startpos --return to start
end

Here's the part and its' components: https://i.ibb.co/M5WPF5F/Capture.png

0
Additionally, it was working until roblox recently updated. Now its not. :/ holadivinus 4 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

BodyMovers are legacy, so I would not use them for new versions of work.

https://developer.roblox.com/en-us/api-reference/class/AlignPosition

I am not completely sure but I think it might not be moving because of the BodyGyro.

Ad
Log in to vote
0
Answered by 4 years ago

Moving the part up and back to the original location magically fixed it. I really dont know why.

Answer this question