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

Why does this weld script break the player's movement animations?

I am trying to give the player a slight blue glow by cloning its body parts, making them slightly bigger than the original, and welding it to the original. This is the function that does this:

function placePart(char, v)
	char.Archivable = true
	v.Anchored = true
	local part = v:Clone()
	part.Parent = char
	part.BrickColor = BrickColor.new("Toothpaste")
	part.Material = "Neon"
	part.Transparency = .94
	part.CanCollide = false
	part.Size = part.Size + Vector3.new(0.1,0.1,0.1)
	part.CFrame = v.CFrame
	part.Name = "WeldedPart"
	weld(part, v)
	part.Anchored = false
	bodyParts[#bodyParts + 1] = part
	wait()
	v.Anchored= false
end

I call that function here:

local char = player.Character
		local rootPart = char.HumanoidRootPart
		local rh = char.RightHand
		local fold = char:WaitForChild("Attack Storage")
		local assets = rep.Assets.Lightning
		
		for _,v in pairs(char:GetChildren()) do 
			if (v:IsA("MeshPart") or v:IsA("Part")) and v.Name ~= "Head" then
				coroutine.wrap(placePart)(char, v)
			elseif v.Name == "Head" then
				local mesh = assets.HeadMesh:Clone()
			--	v.Anchored = true
				mesh.Name = "WeldedPart"
				mesh.CFrame = char.Head.CFrame
				mesh.Parent = char
				weld(v, mesh)
				bodyParts[#bodyParts + 1] = mesh
				v.Anchored = false
			end
		end		

Please note that not all code I wrote is included. I know for a fact the other code did not cause this problem.

1 comment

0

I have fixed the problem by simply clearing the children of the cloned part.

1 answer

I have fixed the problem by simply clearing the children of the cloned part.

function placePart(char, v)
	local part = v:Clone()
	part:ClearAllChildren()
	part.Parent = char
	part.BrickColor = BrickColor.new("Toothpaste")
	part.Material = "Neon"
	part.Transparency = .94
	part.CanCollide = false
	part.Size = part.Size + Vector3.new(0.1,0.1,0.1)
	part.CFrame = v.CFrame
	part.Name = "WeldedPart"
	weld(part, v)
	bodyParts[#bodyParts + 1] = part
end

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