I can make it bounce back and forth around the Y value I want it to stay at, but I don't want that. I want it to go to that Y value and then stay there. I also don't want it to increment in the way that it is incrementing right now. If there is no anchored brick below it, it will slowly begin swinging between more and more extreme Y values, eventually falling all the way down to the deletion zone and disappearing.

Problems:

  1. Bounces back and forth around the Y value I want it to stay at
  2. One bounce's amplitude slowly becomes larger

Code that I have managed to create:

yvel = script.Parent:getMass()*196

while wait() do

script.Parent.BodyForce.Force = Vector3.new(0,yvel,0)

ypos = script.Parent.CFrame.Y

if ypos > 30 then
	yvel = script.Parent:getMass()*(196-math.abs(ypos)*.2)
end

if ypos < 30 then
	yvel = script.Parent:getMass()*(196+math.abs(ypos)*.2)
end

if ypos == 30 then
	yvel = script.Parent:getMass()*196
end

end

Any input would be appreciated :p

2 comments

0

Is this like a challenge you're doing? Why not use BodyPosition, or some easier method?

0

@wfvj014 Because I don't have any experience with body movers and thought that BodyPosition changed the position of the brick instantaneously. If it doesn't, then I'll use it or something. I'll have to look it up on the wiki but I probably won't understand a word that it says; I never do.