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

Weld breaks when position changed by script?

I made my script, the script works, but when it moves the brick, the second brick (which I used a weld plugin to weld with the first brick) doesn't move with it![EDIT2] Changed to CFrame, but now get an "Expected Vector3 got CFrame" Here is my moving script

repeat
wait(2.5)
local victim = workspace:FindFirstChild("Player")
print(victim.Torso.CFrame.X)
wait(0.0001)
	repeat
		wait(0.000001)
		repeat
			wait(0.000001)
			if script.Parent.CFrame.X ~= victim.Torso.CFrame.X then
				if victim.Torso.CFrame.X > script.Parent.CFrame.X then
					
					script.Parent.CFrame = CFrame.new(script.Parent.CFrame + Vector3.new(1,0,0))
				elseif victim.Torso.CFrame.X < script.Parent.CFrame.X then
					
					script.Parent.CFrame = Vector3.new(script.Parent.CFrame - CFrame.new(1,0,0))
				elseif victim.Torso.CFrame.X == script.Parent.CFrame.X then
					print("found")
				end
			end
		until script.Parent.Position.X == victim.Torso.Position.X
	until 9 + 10 == 21
until 9 + 10 == 21

Please help!!! Thank you!!!

1 comment

0

The smallest wait() you can use is renderstepped.

1 answer

If you set the position of a part, it breaks its welds. You can tell if you try to set the position of your own head, because it makes you die.

If you set the CFrame, however, the welded parts will not disjoin, as you can tell if you set the CFrame of your Torso and you teleport.

4 comments

0

I changed my script, what is wrong?

0

I don't know what is wrong, why are you asking me what is wrong?

0

because you helped me with the first one, im sorry for assuming that you helped me... must have been someone else

0

Use CFrame.new() and not Vector3.new() when defining a CFrame.

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