Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does my body position script stop moving after like 4 moves??

Can someone help? I have this script. And the part moves for like.. 4 times? then it just stops. no output. nothing. help?

script:

local BP = script.Parent.BodyPosition
while true do
	BP.Position = script.Parent.Parent:WaitForChild('Start').Position
	wait(2)
	BP.Position = script.Parent.Parent:WaitForChild('End').Position
	wait(2)
end

Can somebody help? I need it to move it move it,, move It move it. move it move it. move it move it.

3 comments

0

i think that because youre using waitforchild it might have waited and gotten the wrong child and then errored if it got destroyed. just a theory

0

Correct, but why is it getting destroyed?

0

well what happens to 'Start' and 'End'? i was assuming that you were destroying them

1 answer

✓ Accepted answer

So, I found a liitle fix. You gotta delete the BodyPosition in the part and keep the script inside the part.

Also make sure, the part isnt anchored or don't have any welds.

local BP = Instance.new("BodyPosition", script.Parent)
BP.MaxForce = Vector3.new(40000, 40000, 40000)

while wait() do
	BP.Position = script.Parent.Parent:WaitForChild('Start').Position
	print("At Start")
	wait(2)
	BP.Position = script.Parent.Parent:WaitForChild('End').Position
	print("At End")
	wait(2)
end

Please Upvote and lemme know if it helps!

2 comments

0

oh, i got it working, im gonna accept you answer cause im sure it works. but i just used the vector 3 instead. Thanks so much for the answer!

0

Glad to hear that! Well the script above is tested in Studio, so it will work.

This discussion is preserved as it was. New answers, comments, and votes are closed.