Why isn't my weld working?

Been a while since I’ve used welds, but I had copied some old code of mine that welds a model to the player which works fine in the old code but doesn’t work now in the new code and I’m not entirely sure what I did differently to cause it to not work.

Here’s the new code

function BeyLauncher.new(character)
	local self = setmetatable({},BeyLauncher)
	
	self.launcher = launcher:clone()
	self.launcher.Parent = character	
	
	self.character = character
	
	self:unequip()
	
	return self
end

function BeyLauncher:weldParts(part0,part1)
	local weld = Instance.new("WeldConstraint")
	weld.Part0 = part1
	weld.Part1 = part0
	weld.Name = "LauncherWeld"
	weld.Parent = part0
end

function BeyLauncher:unequip()
	local cframe1 = CFrame.Angles(0, math.rad(90), math.rad(30))
	local cframe2 = CFrame.Angles(math.deg(120),0,0)
	local torso = self.character:WaitForChild("Torso")
	
	self.launcher:PivotTo(torso.CFrame * CFrame.new(1,-0.9,-0.5) * cframe1 * cframe2)
	self:weldParts(launcher.Grip,torso)
end

And heres the old code

function Launcher:MakeLauncher(character,color)
	warn("[SERVER]: Making a launcher for "..character.Name)
	
	local color3 = nil
	local launcher = nil
	
	if Players:GetPlayerFromCharacter(character) then
		local player = Players:GetPlayerFromCharacter(character)
		local launcherColor = Data:GetData(player,"launcherColor")
		color3 = Color3.fromRGB(launcherColor[1],launcherColor[2],launcherColor[3])	
		launcher = RepStorage:WaitForChild(Data:GetData(player,"currentLauncher")):Clone()
	else
		launcher = RepStorage:WaitForChild("Launcher"):Clone()
		color3 = color
	end

	launcher.Launcher.Color = color3
	launcher.Part.Color = color3
	launcher.Part.Part.Color = color3
	launcher.Name = character.Name.." launcher"
	launcher.Parent = character
	
	warn("[SERVER]: Created a new launcher with the color: "..tostring(color3))

	return launcher
end

function Launcher:Unequip(character)
	Launcher:DestroyLauncher(character)
	local launcher = Launcher:MakeLauncher(character)
	launcher.Parent = character
	local cframe1 = CFrame.Angles(0, math.rad(90), math.rad(30))
	local cframe2 = CFrame.Angles(math.deg(120),0,0)
	launcher:SetPrimaryPartCFrame(character["Torso"].CFrame * CFrame.new(1,-0.9,-0.5) * cframe1 * cframe2)
	Utils:WeldParts(launcher.PrimaryPart,character["Torso"])	
end

Apparently, I’m blind haha forgot to do self.launcher in self:weldParts() was welding the non cloned model.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.