Whats wrong with my moving part?

The script is working, the only problem is that when I start the game, my platform falls to the ground. It still moves back and forth but; it doesn’t stay in the correct place on the Y axis.

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

Thanks! :slight_smile:

4 Likes

Set anchroing to tru. I think thts the issue

If I set it to true, it doesn’t move at all. That’s how BodyPosition works.

Would you mind elaborating? As far as I’m aware; you cant anchor a BodyPosition.
image

Make sure you’re putting enough force on the Y axis.

I’m already did that. Thank you for the suggestion though! :slight_smile:

Have you tried enabling the Massless property of the part?

The part still falls down. I believe gravity still pulls down massless parts.

Are start and finish correctly anchored?

yes, Start and Finish are anchored and canCollide == false

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

local bv = Instance.new("BodyVelocity")
bv.Velocity = Vector3.new(0, 0, 0)
bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bv.P = 9000
bv.Parent = script.Parent

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

Change the “9000” value if necessary.

The part is no longer moving when using that script. I’m not sure why.

start = script.Parent.Parent.Start
finish = script.Parent.Parent.Finish
bodyposition = script.Parent.BodyPosition
local toggle = false

bodyposition.ReachedTarget:Connect(function()
	if not toggle then
		bodyposition.Position = finish.Position
		toggle = true
	elseif toggle then
		bodyposition.Position = start.Position
		toggle = false
	end
end)

bodyposition.Position = start.Position

You may want to re-add the waits.

Now the script stops shortly after it starts. (And it still falls)
Edit: If you’re aware of another way to move the part please let me know. :slight_smile: