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

How to weld a model to player's torso?

well uh read the title...

4 comments

0

i tried many things but nothing worked

0

Your question is a bit confusing. A backpack in itself is not a tool but contain tools. A backpack store tools. So is it that you want a custom backpack or tools that doesnt use the "orange hammer" item that is default by roblox

0

i just wanna weld something to player's torso when they join the game

0

and i dont know how :|

3 answers

game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Char)
local Part = Char:WaitForChild("HumanoidRootPart")
local Weld = Instance.new("Weld", Char)
WhatYouWantToWeld.CFrame = Part.CFrame
Weld.Part0 = Part
Weld.Part1 = WhatYouWantToWeld
Weld.C0 = Part.CFrame:inverse()
Weld.C1 = WhatYouWantToWeld.CFrame:inverse()
end)
end)

2 comments

0

the thing i want to weld gotta be somewhere specific or i can just get it from workspace?

0

also does it work with unions and models? because this is what i try to weld

As shown in the wiki http://wiki.roblox.com/index.php?title=Weld. Note that im using a serverscript.

---- Weld Function taken from wiki (note only 2 parts can weld with this function)----

local function weldBetween(a, b)
	--Make a new Weld and Parent it to a.
	local weld = Instance.new("ManualWeld", a)
	--Get the CFrame of b relative to a.
	weld.C0 = a.CFrame:inverse() * b.CFrame
	--Set the Part0 and Part1 properties respectively
	weld.Part0 = a
	weld.Part1 = b
	--Return the reference to the weld so that you can change it later.
	return weld
end


--- NOTE: if its r15 Torso is called LowerTorso or UpperTorso. In r6 its Torso. For simplicity lets use HumanoidRootPart

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)

		local ChosenPart = ""-- place something that you want to weld to torso 
		weldBetween(ChosenPart,character("HumanoidRootPart")
	

	end)
end)


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