I’m currently working on a game concept but I’m having an issue with it. As I keep deleting welds within the model, there seems to be some parts floating in the air and I’ve been trying to diagnose this problem.
I’ve heard that IsGrounded() is a great method to use, but I’ve been using it countless times and it doesn’t seem to be working. I was told that it works not with just Anchored parts, but also Welded parts. However, that doesn’t seem to be true.
When you delete welds you also have to delete any welds in other Parts that are welded to the floating Part. If you try dragging the floating Part in Studio test mode with all the model’s Parts Unanchored you’ll probably see the entire model move with it since there are still active welds from other items.
I’m curious how I would be able to accomplish that though. Because even if I used IsGrounded() or GetTouchingParts(), there’s still gonna be points where huge chunks are floating in mid air.
I’m just skeptical on how I would be able to define those parts without know the name of those random parts that can potentially be floating.
To visually verify that @Scottifly has identified the problem, try doing this: In studio, the model tab, make sure that Show Welds, Constraint Details, and Draw On Top are all selected:
Then under the Test tab, use the Clients and Servers method of testing.
When you click “Start” you should be able to see all the welds in both the “Server” window that launches and in the “Client” window that launches (where you can be the player). I use WeldConstraint’s rather than Weld’s, and I can see WeldContraint’s in my game using that technique. Hopefully it works for Weld’s too.
It looks like you might be randomly picking a part and then deleting all welds touching that part. Just off the top of my head, to avoid floating parts, would this work:
select random part
Make a table of all parts that are welded to your randomly selected part (either Part0 or Part1 of each weld)
Delete welds attached to random part
Check each of the parts in the table you created to see if they have touching parts. If there are no touching parts, then delete all welds connected to the part in your table–being sure to follow these steps–and remove the part from the table.
Once you have removed all parts from the table that have no touching parts, then you select your next random part.
How would I be able to accomplish that? I’m deleting the WeldConstraints serversided in the ServerScriptService, would I have to utilize the work of deleting welds with Remote events?