Welding model to character

Hello,
I was trying to weld a shark fin to character’s back using this piece of code:

local sharkFin = game.ServerStorage.SharkFin:Clone()
local weld = Instance.new("Weld")
weld.Part0 = character:FindFirstChild("UpperTorso")
weld.Part1 = sharkFin
weld.Parent = character:FindFirstChild("UpperTorso")	
sharkFin.Parent = character

But ended up with the fin welding in the wrong place. I tried using several CFrame values for C0 and C1 without a success. Should I use attachment or Weld Constraint instead?

I suggest using WeldConstraints, and just adjusting the position and possibly the rotation of the sharkFin.
Not much to say here, besides maybe link the article to WeldConstraints.
Hope this helps, and works for you!

local sharkFin = game.ServerStorage.SharkFin:Clone()
local torso = character.UpperTorso

local weld = Instance.new("WeldConstraint")
weld.Part0 = sharkFin
weld.Part1 = torso
weld.Parent = sharkFin

sharkFin.CFrame = torso.CFrame * CFrame.new(0, 0, torso.Size.Z/2 + sharkFin.Size.Z/2)
sharkFin.Parent = character

This should work. WeldConstraints are much easier to use and keep the position relative to the object. Also, you don’t need to use :FindFirstChild() as you don’t even check if it’s there before using it. Another thing is to parent welds to the shark fin because if you destroy the shark fin, it will destroy the weld also instead of lingering in the torso.

2 Likes

i have covered this many times but its a long explanation so im just going to use an old explanation:
a proper way i use to do this is making weld proxys what i mean is a i get a dummy, make him transparent:
image
and then i allign the tool, hat whatever ( in this case tool) to where i want it to be :
image
Now time for the proxy i will spawn a part scale it down to a small cube ( i use .25 as my increment):
image
i type into the command bar:

image

which as u can see positions it perfectly in the root part (the body part you want to weld your tool to)
i then group the tool and the proxy together (and make sure everything inside them is welded together using a plugin (but because ur using a mesh its all one thing anyway so just weld the proxy and mesh together) and now when ur welding it to the hip it should look sumn like this:

local function unequipped()--fires when the tool is no longer in hand or whenever u want it
	tool.proxy.CFrame = Character.LowerTorso.CFrame
	local Weld = Instance.new("Weld")
	tool.proxy.CFrame = Character.LowerTorso.CFrame
	Weld.Part0 = tool.proxy
	Weld.Part1 = Character.LowerTorso
	Weld.C0 = tool.proxy.CFrame:Inverse()
	Weld.C1 = Character.LowerTorso.CFrame:Inverse()
	Weld.Parent = tool.proxy
end

and here is an example of me using it in the past:

image
image
image

3 Likes

Quick question, where would this script go?

You can put it wherever you want it as long as you have the player/character. If you want something to attach to them when they spawn, put it in a CharacterAdded function. If you want something to weld to them when they transform, put it some server script with a remote event. As long as it’s on the server it will replicate to everyone else.

1 Like

That works now, thank you for the help.

1 Like