New union sometimes doest not load in game after using SubtractAsync() function

Sometimes in-game the new union that is supposed to be formed after using the aforementioned function goes completely transparent. Although the new union is there and the transparency is 0, it is as if the new union is not loading. Is there anyway to ensure that new unions created always loads. Also, this function is wrapped in a pcall() as prescribed by roblox.

1 Like

Never really understood why they didn’t just make it return nil in case the operation failed, or a string. Seems like a needless usage of pcall.

Back to your issue, this seems like a problem on Roblox’s end. There were many reports of this issue, but they were mostly in studio. Seems like it’s an issue with CSGv2, so not much you can do other than wait for it to get resolved.

All of this is valid of course only if you are performing the operations correctly. Try checking whether the union even has a volume.

2 Likes

Probably for the same reason anything else errors when it doesn’t work? If it returned a string when it didn’t work, that would be super confusing for debugging.

:GetPlayerFromCharacter() doesn’t as well as a handful of other methods. If there is a chance that the function will cause errors that are not caused by bad code, then they shouldn’t throw an error, but return something that will give the developer an idea of what is happening like nil.

Errors stop the current running thread, basically breaking the game. Something like a failed union that isn’t that important shouldn’t be a reason to use pcall.

Yeah it works sometimes but after it just doesnt load the newunion even though its there in the workspace and it can be collided with , however its completely transparent. And I used the :GetMass() function and printed out the mass and it did have a mass. Is there anyway I can check if the union is loaded or wait until its loaded because in other games that use this function the newunion always loads

When a function fails, it should error. GetPlayerFromCharacter returns nil when there’s no player with that model as the character, the function itself didn’t fail. If it was a real character and the function somehow broke then it would make more sense to error than to return nil.

1 Like

My last attempt would be to try :PreloadAsync(). It probably won’t work as it was meant for fetching assets, but at this point, there is nothing else you can do.

That’s what warnings are for.

WORDS

When a function fails to work, that’s definitely not what warnings are for. Warnings are for stuff like WaitForChild taking a little too long or an image not loading properly, not for when a function doesn’t do anything close to what it’s intended for. By your logic, nothing should ever error because “that’s what warnings are for.”

1 Like

Errors are for cases when the developer made a mistake in their code and the function couldn’t be executed by their own mistake. The code stops to avoid game breaking loops or incorrect permanent changes.

Warnings are there to give creators a way to determine an eventual issue that might be due to them or the engine itself.

This is definitely the later as developers can do nothing if the algorithm decides that the 2 chosen parts aren’t compatible, but not being able to create unions can in no way cause the game to crash or affect something like data stores.

No, that’s not what errors are for. Your logic makes no sense at all. If a datastore request fails because Roblox’s servers are having an issue, do you want it to just give a warning? Almost all of Roblox internal issues throw an error, that’s not even close to what warnings are supposed to be used for. I’m pretty sure a union not existing would cause a game breaking loop when you try to parent only to find out that your awful idea causes the error of “attempt to index a string value” which would be a gigantic pain to debug. If a function is supposed to return an instance, it shouldn’t randomly return a string and give a warning.

2 Likes

If a datastore request fails, then there is a high chance it will cause issues which the developer must be aware of.

Parenting something to nil would also be an issue with GetPlayerFromCharacter, but that’s why we have sanity checks.

There are a lot of cases in which unions can fail, and they should only throw an error if one of the objects to union isn’t of a compatible class.

then how does the unions always loads in other games like bloxburg when they make pools

Looks like their map is created from tiles which get deleted when you want to make a pool, though I’m not sure.

1 Like