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

Why Does Part1 in the weld equal NIL?

I tried everything. I was cloning the vest, but it wasn't attaching to the torso. So I found out that Part1 wasn't even appearing even though I put it in the script below. By the way, the vest is an individual part in the replicated storage, FE is off.

if script.Parent.Parent.Selected.Value == 1 then
	local vest = Lighting.TacticalVest:Clone()
	vest:Clone().Parent = script.Parent.Parent.Parent.Parent.Parent.Character
	local weld = Instance.new("Weld")
	weld.Name = "VestWeld"
	weld.Part0 = script.Parent.Parent.Parent.Parent.Parent.Character.Torso
	weld.Part1 = vest
	print(vest)
	weld.C0 = CFrame.new(0,0,0)
	weld.Parent = script.Parent.Parent.Parent.Parent.Parent.Character.Torso
	end

1 answer

✓ Accepted answer

You're creating two clones of the vest, one with a weld that isn't parented to workspace, and one without a weld that is parented to workspace. Just remove "Clone" in line 3 to fix the problem by using the same clone for both problems.

if script.Parent.Parent.Selected.Value == 1 then
    local vest = Lighting.TacticalVest:Clone()
    vest.Parent = script.Parent.Parent.Parent.Parent.Parent.Character
    local weld = Instance.new("Weld")
    weld.Name = "VestWeld"
    weld.Parent = script.Parent.Parent.Parent.Parent.Parent.Character.Torso
    weld.Part0 = script.Parent.Parent.Parent.Parent.Parent.Character.Torso
    weld.Part1 = vest
    print(vest)
    weld.C0 = CFrame.new(0,0,0)
end

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