WeldConstraints stop parts from moving

I coded a part that rotates and levitates. For some reason when I use weld constraints the parts just stay in place instead of moving with the part they’re welded to.

Video:

The parts are unanchored and CanCollide Off. The part they’re welded to is Anchored.

In the weld constraint I have Part1 as the part and Part0 as the part being welded to.

Code (parented to the part everything is welded to) :

local part = script.Parent

local amplitude = 1.5 -- offset on both sides
local magnitude = 2.5 -- time it takes to move from the bottom -> top, and top -> bottom

local defaultCFrame = part.Position

--// Float

game:GetService("RunService").Stepped:Connect(function()

	part.Position = defaultCFrame  + Vector3.new(0, amplitude*math.sin(tick()*math.pi/magnitude), 0)
	
end)

--// Rotate
local PartSpeed = 0.05

local Part = script.Parent
local incr = 360/160
while wait() do
	for deg = 0, 360, incr do
		part.Rotation = Vector3.new(deg, deg, 0)
		wait()
	end
end

1 Like

Weld Constraints make an assembly.

Assemblies use the RootPart for the physics settings.

So try:
Make sure you set your root part correctly. Set the RootPriority of the main psrt to 1 or higher
or
Make sure you reference the rootpart correctly in the script and make sure that it is the part which is moving.

I found this out while trying to animate an npc rig, dont use weldconstraints if you want things to move freely, use motor6d’s