Welding an object to the Player

Hello everyone, so to keep it simple and short… I am trying to weld a pair of wings to the player’s back when the player presses ‘R’. I already have the R button press detection and remote event fire set up.

For some reason, the wings to spawn on the players back but they do NOT weld. They just fall.
https://gyazo.com/cd04beaf265083e73a6d701609232a09

I have been searching on YouTube… on dev forum and following things what other scripters have tried to do, but all in vain. Please help if you can.

Here is the script:

local tweenService = game:GetService("TweenService")
local replicatedStorage = game:GetService("ReplicatedStorage")

local remote = replicatedStorage:WaitForChild("Remotes"):WaitForChild("WingActivation")
local resize = replicatedStorage:WaitForChild("Objects"):WaitForChild("Wings"):Clone()

local Goal = {}
Goal.Size = Vector3.new(1.798, 5.315, 1.641)

local tweenInfo = TweenInfo.new(3)

function Weld(weldMe, toThis)
	local weld = Instance.new("Weld")
	weld.Part0 = weldMe
	weld.Part1 = toThis
	weld.C0 = weldMe.CFrame
	weld.C1 = toThis.CFrame
	weld.Parent = toThis
end

remote.OnServerEvent:Connect(function(player, message)
	local Character = player.Character
	local Torso = Character:WaitForChild("Torso")
	if message == "Equip" then
		
		resize:SetPrimaryPartCFrame(Torso.CFrame)
		resize.Parent = workspace
		Weld(resize.PrimaryPart, Torso)
		
		
	elseif message == "Unequip" then
		
	end
end)

Are these wings an accessory? In that case, you can use Humanoid:AddAccessory()

No, the wings are just mesh parts.

Ah sorry no idea then, I haven’t really used welds and I’m bad with the physics part of roblox.

1 Like

Probably a dumb question, but are the meshparts welded to each other as well? Maybe also try a WeldConstraint rather than a Weld?

Yeah, I have a primary part in the wing model which has a WeldConstraint that has everything welded together.

Clone the wings in the OnServerEvent event (Currently you are cloning only 1 pair of wings in the script).Also use WeldConstraint to anchor them both so they don’t fall.

Perhaps use a WeldConstraint rather than a Weld?

function Weld(weldMe, toThis)
    print("Welding Debug Print")
	local weld = Instance.new("WeldConstraint")
	weld.Part0 = weldMe
	weld.Part1 = toThis
	weld.Parent = toThis
end

And if that doesn’t work either, try switching around the Part0, Part1, and Parent? And as @HighFoxyplayz11 mentioned, clone the wings in the OnServerEvent, not outside of it, as it’s only making a single clone

For wings, you can put it in workspace, and pre-set a Motor6D or something different. I’d recommend using Moon Animator to do that though. And then put it back in Objects.

How to do this?
You should have a PrimaryPart, and a Character Rig.
You select the Character Rig’s HumanoidRootPart first, and then the PrimaryPart second,
then Weld in place with Moon Animator.

Here’s how it would work.
The next time you clone it, take the Weld object, and replace it’s C0 with the character’s HumanoidRootPart, and then you’re done.

@EmbatTheHybrid, he might also need them to be able to be rotated. So he might need to use a weld. I don’t know if you can rotate an object with Orientation and have a Weld or WeldConstraint at the same time.

Ok so I did what you said about cloning the wings in the OnServerEvent, and I also added a weldconstraint to both of the wings. They still manage to fall.

I did this too, but it still doesn’t work.

I mean weld them through the script and clone them through the script.

local tweenService = game:GetService("TweenService")
local replicatedStorage = game:GetService("ReplicatedStorage")

local remote = replicatedStorage:WaitForChild("Remotes"):WaitForChild("WingActivation")


local Goal = {}
Goal.Size = Vector3.new(1.798, 5.315, 1.641)

local tweenInfo = TweenInfo.new(3)

function Weld(weldMe, toThis)
	local weld = Instance.new("Weld")
	weld.Part0 = weldMe
	weld.Part1 = toThis
	weld.C0 = weldMe.CFrame
	weld.C1 = toThis.CFrame
	weld.Parent = toThis
end

remote.OnServerEvent:Connect(function(player, message)
	local Character = player.Character
	local Torso = Character:WaitForChild("Torso")
	if message == "Equip" then
		local resize = replicatedStorage:WaitForChild("Objects"):WaitForChild("Wings"):Clone() -- This will clone the wings everytime you call this event
		resize:SetPrimaryPartCFrame(Torso.CFrame)
		resize.Parent = workspace
		Weld(resize.PrimaryPart, Torso)
		
		
	elseif message == "Unequip" then
		
	end
end)

Yes, I did that, however, the wings falling problem persists.

Its probably because the wings are not properly welded to the player. (I still very rookie at scripting, so I’m not sure)

Can you elaborate more? What would you mean by properly welding the wings to the player?

Is this mesh made in an external program or found in the meshes section of the toolbox, or was it made with parts? If it was one of the first two methods it’s hitbox could be messed up, if there is any.

Here are some possible fixes if the hitbox is incorrect.

Hey guys, with the help of a friend, I found a solution, thanks to @PriestOfCheems, he told me to use a weld plugin and weld the parts in the model together and the way I had it before, which was through a WeldConstraint was incorrect.

Link to the Weld Plugin:

2 Likes