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

Why is my model weld script not working when cloned to workspace from Replicated Storage?

Full context: I am trying to make a morph script and I am stuck on the welding part. My plan is to take the body part model (Head) and weld everything to the "Basepart" or original head part in my morph which I call "Middle". I put a welding script inside of the (Head) model and it works perfectly, in the workspace and in Replicated Storage. The **problem **is that when I :Clone() that (Head) model and parent it to workspace the weld script stopped working. To fix this I tried putting the weld script on a while true loop, but that failed. Is there any reason for this happening?

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local T = ReplicatedStorage.Morphs.Cadet.Head:Clone()

T.Parent = game.Workspace

:Clone() script^

local prev 
local parts = script.Parent:GetChildren() 
for i = 1,#parts do 
	if (parts[i].className == "Part" 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 
		end 
		prev = parts[i] 
		end 
	end

Weld script

1 answer

The original weld Script had my while true loop and when I removed it, it started working again.

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