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

How do I weld a Union to a player's torso?

So I've seen some scripts/videos of people creating a block they want in the script, like sizing it, making it the right color ect and then welding it to a player but I would like to weld a specific (slightly complicated) union to a player. Like the Union is already in workspace im just not sure how to get it to weld to player

3 answers

game.Players.PlayerAdded:connect(function()
	local Weld = Instance.new("Weld", game.Players.LocalPlayer.Backack.Union) --put the union in starterPack
	Weld.Part0 = Weld.Parent
	Weld.Part1 = game.Players.LocalPlayer.Character.Torso
	Weld.C0 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) --position the union
end)

2 comments

0

For future reference it's "Backpack" instead of "Backack"

0

what was the point of your message. i know its backpack, i just made a mistake.

First we create a weld instance

local w = Instance.new("Weld")

Then we add which two parts its welded between

w.Part0=character.Torso
w.Part1=union

Then we can change the way its connected to it, like back one stud up one stud rotated this

w.C0=CFrame.new(0,1,0)*CFrame.Angles(math.rad(90),0,0)--up 1 stud rotated 90 on the x axis

Then we parent the weld, usually to the Part0

w.Parent=character.Torso

Let's put it together

local w = Instance.new("Weld")
w.Part0=character.Torso
w.Part1=union
w.C0=CFrame.new(0,1,0)*CFrame.Angles(math.rad(90),0,0)
w.Parent=character.Torso

more info

6 comments

0

It says attempt to index glocal "character" (a nil value) however so like it's not finding the chracter?

0

one way to make it one line shorter(if you REALLY wanted to) would to add a comma after "Weld" in the instance then put the address of the parent

0

my script didn't include the character and union variables

0

@wookey12 You shouldn't be doing that when you are going to change the properties of the instance

0

@DanzLua you still can change the properties of weld (w.Part0, w.Part1,etc.) it just makes it shorter

0

@wookey12 Making the code shorter isn't everything, you also have to think about efficiency. http://devforum.roblox.com/t/psa-dont-use-instance-new-with-parent-argument/30296

If you want too make a part get connected to the torso then

IF R15 game:

--Put this in a script inside ServerScriptService
--Put the Union inside the ServerStorage
game.Players.PlayerAdded:connect(function(plr) --Function when a player joins
	plr.CharacterAdded:connect(function(char)
		--Now that the function is done, now what, we have to weld the part/union
		local w = Instance.new("ManualWeld")
		w.Part0 = char.UpperTorso --Replace UpperTorso to LowerTorso to get the LowerTorso
		local union = game:GetService("ServerStorage").Union:Clone() --rename what the union name --is
		union.Parent = char
		w.Parent = plr.Backpack
		w.C0 = CFrame.new(0,0,0) --Change the value you want
	end
end

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