How can i weld a model to a character's part

I am trying to weld a model to the character’s left hand but it doesn’t work

 local Players = game:GetService("Players") local tool:Tool = script.Parent local model:Model local function Modelise() : Model	local character =	tool.Parent	and tool.Parent:IsA("Model")	and Players:GetPlayerFromCharacter(tool.Parent)	and tool.Parent or nil	if not character then warn("non") return end	if typeof(model) == "Instance" then	model:Destroy()	end	local Model = Instance.new("Model")	Model.Parent = character	local weld = Instance.new("Weld",Model)	for _,part in tool:GetChildren() do	if not part:IsA("BasePart") then continue end	local new = part:Clone()	new.Parent = Model	new.Massless = true	new.Destroying:Connect(function()	print("nah")	end)	if part.Name == "Handle" then	Model.PrimaryPart = new	end	end	if Model.PrimaryPart then	local lefthand:BasePart = character:FindFirstChild("LeftHand")	if lefthand then	Model.PrimaryPart:PivotTo(lefthand.CFrame*CFrame.fromEulerAngles(0,0,0))	weld.Part0 = Model.PrimaryPart	weld.Part1 = lefthand	weld.Enabled = true	end	end	model = Model	return Model end tool.Equipped:Connect(function()	Modelise() end) tool.Unequipped:Connect(function()	if model then	model:Destroy()	model = nil	end end) 

it seems you are trying to make a Tool, have you check this doc?

if there is additional meshes that is in a Model, you can simply weld the Model’s primary part to the tool’s Handle part.

1 Like
local Players = game:GetService("Players") local tool: Tool = script.Parent local model: Model local function Modelise(): Model local character = tool.Parent and tool.Parent:IsA("Model") and Players:GetPlayerFromCharacter(tool.Parent) and tool.Parent or nil if not character then warn("Character not found") return end if typeof(model) == "Instance" then model:Destroy() end local Model = Instance.new("Model") Model.Parent = character local weld = Instance.new("WeldConstraint") weld.Parent = Model for _, part in tool:GetChildren() do if not part:IsA("BasePart") then continue end local new = part:Clone() new.Parent = Model new.Massless = true if part.Name == "Handle" then Model.PrimaryPart = new end end if Model.PrimaryPart then local lefthand: BasePart = character:FindFirstChild("LeftHand") if lefthand then Model.PrimaryPart.CFrame = lefthand.CFrame weld.Part0 = Model.PrimaryPart weld.Part1 = lefthand weld.Enabled = true else warn("LeftHand not found in character") end else warn("PrimaryPart not set in model") end model = Model return Model end tool.Equipped:Connect(function() Modelise() end) tool.Unequipped:Connect(function() if model then model:Destroy() model = nil end end) 

try this one, i tweaked your code.

2 Likes

this is out of topic, but the ui and everything is similar to Saber Simulator

Found a solution myself by just making a clone of the tool and parenting its part to the model instead of cloning all the parts one by one.

yes me and my friends are creating a og version of it

consider to add more dna in ur game (:

1 Like

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