Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
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

Log in to vote
1
Answered by
Bellyrium 310 Moderation Voter
6 years ago
Edited 6 years ago

: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
Ad
Log in to vote
0
Answered by 6 years ago

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.

Answer this question