Resizing parts programatically shouldn't cause so many problems

There are two main issues with resizing parts programatically: doing so breaks joints, and it also moves the part upwards so it’s not touching anything. I’ve encountered both of these numerous times while developing my own projects where I couldn’t figure out what the issue was, but more importantly I’ve also encountered both while helping developers new to programming.

  • As posted here I spent half an hour helping someone from Scripting Helpers debug something in TC and it turned out to be breaking because he was setting the size after CFrame.
  • I just helped @SolidBlocks figure out why a welded part kept falling off his character and it was because he was setting the part’s size after welding it

Even knowing of these problems, I’ll spend substantial amounts of time thinking its my code, when the problem is due to a non-intuitive, undocumented, implicit feature. And that’s as a developer of eight years – I can’t imagine how long someone who’s never encountered that problem before would spend. Resizing parts shouldn’t cause either of these behaviors, which should be done explicitly as @Anaminus suggested here

19 Likes

The weld problem can be solved in lua using a weld script, similar to:

The root cause is that the problem isn’t actually known, so we can’t insert a weld script to fix it if we don’t know we should be inserting the weld script. This affects everyone who programs on ROBLOX as well, so I imagine an in-house fix would be more appropriate than a user-provided module.

I’m assuming this is legacy from when roblox was more of a building game (remember all the games that involved building with build tools?) so parts were told to reposition themselves when resizing / moving.

Nowadays I imagine we would implement this as a studio-only thing.

Even in Studio re-positioning parts would cause problems – testing mostly, but with plugins aside from that.

Is there any way a method like BasePart:GetJoints() might be useful could be implemented in order to be able to get all of a part’s welds and manually update or preserve them?

Is there a specific reason any new functionality needs to be implemented?

If I was building something with welds and parts I’d want to modify dynamically, I’d use a weld script like linked above.

If I was building something that was dynamically generating and destroying welds, I’d write some lua that stored references to welds in some sort of reasonable data structure (you can do better than just looping over every weld in the workspace).

1 Like

Adding that functionality would just be another band-aid for the underlying problem. Changing Size shouldn’t cause these destructive side effects.

current best fix imo:

local CF = Part.CFrame
Part.Size = NewSize
Part.CFrame = CF

Simple,easy, effective, though I agree with the intent of this post. This functionality is no longer needed, and I don’t think anyone would miss it anymore if it was gone.

I can’t remember a single game that would benefit from having this in recent times. In all the Roblox games I’ve played, I have only seen one that benefited from it, and it’s oooold