I have a Model with a variety of parts welded together. Then in one of the parts, a BodyVelocity is pushing the model at a rate of 50 SPS.

Everything seems fine right?

Well, when I attempt to Delete one of those welded parts from the model the ENTIRE MODEL stops moving. I checked all the parts after deletion, none where accidentally anchored or anything. The appropriate parts where gone too. I checked the Body Mover and it still was set to try and push the parts to a velocity of 50.

Here is the part of the script that is removing parts.

UIS.InputBegan:Connect(function(inp, gp)
	if not gp then
		
		if inp.KeyCode == Enum.KeyCode.Space then
			local segments = game.Workspace.Model.Segments:GetChildren()
			
			if true then
				segments[#segments]:Destroy()
			end
				
		end
		
		
	end
end)

I searched Google but nothing I saw seem to be similar to my issue.

3 comments

0

You should use a for-loop to iterate through the children to destroy them. The other thing is that you're using UIS so I assume this is a local script. Destroying things in a local script won't replicate for other players.

0

for-loop is actually unnecessary after reading the desc again.

0

Replication is not a priority for this project. I will try the for loop idea. Thx @xPolarium