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

How to make BreakJoints() work when part1 touches part2 and BreakJoints() happen to part2?

wait(5)
	--x = 5 --ignore
	hi = Instance.new("Part")
	hi.Parent = game.Workspace
	hi.Shape = "Ball"
	hi.Transparency = .5
	hi.BrickColor = BrickColor.new(Color3.new(255,175,0))
for i = 1,10,1 do
	wait(.1)
	hi.Size = Vector3.new(i,i,i)
	--hi.Size.Y = i --ignore
	--hi.Size.Z = i --ignore
	ha = game.Workspace:GetChildren()
	ha:BreakJoints()
end

Says the line 14 is not working?

2 answers

:GetChildren() Returns a table. I Would recommend looping through the table. Like so

for int,val in pairs(ha) do -- this steps through each value in the table int == the number and val is the value.
if val:IsA("Model") then -- I am pretty sure models only work with breakjoints, i will look into it.
val:BreakJoints() -- do it
end
end-- close it all up

If you want to break joints in everything in workspace then try:

for i,v in pairs(workspace:GetChildren()) do
	if v:IsA("BasePart") then
		v:BreakJoints()
	end
end

although I don't know why you would want this. Its just that, from your code this looks like what you are trying to do.

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