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

How to find a weld using FindFirstChild?

I am making a derby game, when a car hits a rock the car would get destroyed like in those old roblox games, the car is made out of welds and parts.

the rock should have a script like this in it.

script.Parent.Touched:Connect(function(hit)
	local all = hit.Parent:FindFirstChild("Weld")
	all:Destroy()
end)

but it doesnt work, why?

1 answer

✓ Accepted answer

Your question was vague but I assumed you wanted to remove every weld in hit.Parent?

script.Parent.Touched:Connect(function(hit)
	for i,v in pairs(hit.Parent:GetDescendants()) do
		if v:IsA("Weld") then
			v:Destroy()
		end
	end
end)

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