Body Gyro Script Not Working

Hello, I am making an obby, and one of the items is a moving lava block, I have tried to make one, using this script:

start = script.Parent.Parent.Start
finish = script.Parent.Parent.Finish
bodyposition = script.Parent.BodyPosition

while true do
	bodyposition.Position = start.Position
	wait(2)
	bodyposition.Position = finish.Position
	wait(2)
end

I get no errors in the output, I run the game, and it doesn’t move,

1 Like

There could be a few reasons for this.

  • The brick may still be anchored.
  • The bodyposition’s MaxForce may be too low.
  • The bodyposition’s P may be too low.
  • The brick may be connected to the floor or some other part that is anchored.

Make sure your part is not anchored.

You should be using the Tween Service to move the block, not an unconditioned loop. There are 2 reasons for this, it will run smoother (thus look nicer) and use less server resources.

The tween service can be very choppy sometimes so it’s best to either lerp the position or use bodypositions from my experience.

While they do run smoother on the client, it’s still not guaranteed to always be smooth.

My part is not anchored, these are my properties:

The brick is un-collidable

set the MaxForce to a massive number: 9999999999

see if it works then.

Nope…

Last thing to try is set the P to a big number, Re-adjust if the part is moving too quick.

I would recommend using TweenService instead of a BodyPosition and setting the loop to true.

Set it to Inf, still doesn’t work… However, The part doesn’t fall, even though its not anchored…

I don’t understand how to make it move between two parts though.

The problem seems to be with how you’re setting the bodyposition’s position then…

In your script try doing bodyposition.position = Vector3.new(start.position) etc

If ‘start’ and ‘finish’ are Parts then their positions are already Vector3s

That’s true, my bad. I was thinking it could be a problem with indexing.

The problem would only occur if you were using a locascript (network ownership problems) Otherwise it should work fine as it’s un-cancollide nothing is getting in the way.

I’d suggest moving to lerping or using a for loop.

I’d recommend watching this video on TweenService.

Reffering you to my previous post… Tweening can be very choppy sometimes.

Assuming you’re not using it in a loop, TweenService works really well for just moving a part from one place to another. I’ve used it many times and it was really smooth.

It depends, on the task at hand, and personally I’ve had very choppy results from tweening in the past (especially prominent when there was alot of tweens going on at once)

As soon as I switched to lerp, the animations ran smoother and there still wasn’t a massive drop in performance.