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

How do you weld models, or are you even able to?

The title, idk if it is the issue. i stuck a script so when a player joined, it would stick a helmet on their head.

local Helmet = game.Workspace.Helmet

wait(1)

local weld = Instance.new("Weld", game.Workspace)

weld.Part0 = game.Workspace.Helmet
weld.Part1 = game.Players.LocalPlayer.Character.Head

The helmet IS a model. idk if that changes anything. my output says bad cast, and brings me to line 7 when i click on it. anyone able to help?

1 answer

✓ Accepted answer

No, you cannot weld models themselves. You should first weld all the parts in the model together, then weld one part in the model to the character's head.

Here's a weld script I made a while back, feel free to use and manipulate it to make it work for you. Please leave an upvote if I helped! :)

local prev
local parts = script.Parent:GetChildren()
for i = 1,#parts do
	if ((parts[i].className == "Part") or (parts[i].className == "Handle") or (parts[i].className == "UnionOperation"))  then
		if (prev ~= nil) then
			local weld = Instance.new("Weld")
			weld.Part0 = prev
			weld.Part1 = parts[i]
			weld.C0 = prev.CFrame:inverse()
			weld.C1 = parts[i].CFrame:inverse()
			weld.Parent = prev
			parts[i].Anchored = false
		end
		prev = parts[i]
	end
end
for _,item in pairs(script.Parent:GetChildren()) do
	if item:IsA("UnionOperation") or item:IsA("Part") then
		item.Anchored = false
	end
end

3 comments

0

You need at least 25 rep to upvote https://scriptinghelpers.org/help/user-privileges

0
0

This is an old script. The original asker also does have 25+ rep.

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