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

Problem welding a model to a AI?

Someone in my project has made a model to replace with a basic AI. I've easily welded all the parts to a "torso" in the model, a centre part. However, whenever I attempt to weld this torso part to anything such as the HumanoidRootPart the AI will get very buggy. Glitching, teleporting, ect.

Details - All the parts inside the model have CanCollide set to false and none are anchored.

Here's the welding script..

torso = script.Parent:WaitForChild("Torso")

torso = script.Parent:WaitForChild("Torso")

for _,v in ipairs(script.Parent:GetDescendants()) do
	if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("WedgePart") then
		if v.Name ~= "Torso" then
			local weld = Instance.new("Weld")
			weld.Parent = v
			weld.Part0 = torso
			weld.Part1 = v 
			weld.C0 = torso.CFrame:inverse()
			weld.C1 = v.CFrame:inverse()
			v.CanCollide = false
			wait()
			v.Anchored = false
		elseif v.Name == "Torso" then
			local weld = Instance.new("Weld")
			weld.Parent = v
			weld.Part0 = script.Parent.Parent.RightHand
			weld.Part1 = v 
			weld.C0 = torso.CFrame:inverse()
			weld.C1 = v.CFrame:inverse()
		end
	end
end

Would appreciate any feedback possible :D

4 comments

0

you use r15?

0

what do u think it has torso not uppertorso

0

No, it's R15. The 'Torso' is the name of the centre part of the model.

0

r15 dosnt have a torso insted it has a upper and lower torso

1 answer

Resolved my issue, failed to be specific and people thought I was trying to call "Torso" in an R15 rig. This wasn't the case, I was, in the most horrible way possible creating a custom AI character. Moved on and resolved this issue by simply making a rig from scratch and not trying to bind it to an invisible rig. Take this as a lesson as what NOT to do :D

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