Weld Constraint sets Part CFrame to the RootPart's of a Assembly when created outside Workspace

Since it won’t let me post in engine reports I’ll post here.
There is no documentation that this is intended so I’ll assume it’s a bug.

When you create a weld constraint and weld parts not in workspace, it’ll determine which of the parts should be the root part and set the CFrame of non-root part to the root part. It should not change the CFrame at all.

This happens in Studio and in game online.

Start Model:

Same weld function but welded outside of workspace:
In this case the Ball is the default root so everything gets moved to it.
spawned

Same as above with the black cylinder as root:
Everything is moved to where the black Cylinder was.
changeroot

Here is a Repo place: DrTest.rbxl (23.4 KB)

The weld Script is in ServerScriptService. For those not wanting to download the place:

Script
print("Hello World!")

--Simple way of changing the RootPart of all models
local CollectionService = game:GetService("CollectionService")
for _,model in ipairs(CollectionService:GetTagged("TestModels")) do
	for _,modelDes in ipairs(model:GetDescendants()) do
		if modelDes.Name == "Cylinder" then
			--modelDes.RootPriority = 127 --(un)comment line to see change
		end
	end
end


--does the welding
local function weldModel(model)
	local p0 = model.PrimaryPart or model.Part
	for _,p1 in ipairs(model:GetDescendants()) do
		if not p1:IsA("BasePart") then continue end

		local weldCon = Instance.new("WeldConstraint")
		weldCon.Part0 = p0
		weldCon.Part1 = p1
		weldCon.Parent = p1
	end
end


--welds and clones models into workspace
local redwork = game.Workspace.RedWork
weldModel(redwork)

local greenrep = game.ReplicatedStorage.GreenRep
weldModel(greenrep)
greenrep:Clone().Parent = game.Workspace

local yellowscript = script.YellowScript
weldModel(yellowscript)
yellowscript:Clone().Parent = game.Workspace

local purpserv = game.ServerStorage.PurpServ
weldModel(purpserv)
purpserv:Clone().Parent = game.Workspace

To recreate on your own:

  1. Make model and put parts in it
  2. Copy model, move it over a little, and put anywhere but Workspace.
  3. Weld everything together using script or by hand while model is not in workspace.
  4. Move or Clone back to Workspace

Note: Does not have to be in a model

4 Likes

I’m having a very similar issue with WeldConstraints. Changing the position of the part with the WeldConstraint, with Part0 being set to the parent of the constraint, results in the position being ‘snapped’ to the center of the part it is welded to. As such, the example script in the documentation is broken. This is a very inconvenient issue and I can only assume this is related to the issue you are experiencing.

I have the same issue.

One of my game mechanics broke in my game since the weldconstraints got updated, i tried to re-add the mechanic, but it was impossible to do so since there was no way to offset the weld constraint without it teleporting to the middle of the part.

Right now, i have done it via a hacky way by manually welding it and moving c0 and then enabling the weldconstraint, but if this issue did not exist, i would definitely have moved the position instead.

Easier steps to repro:

  1. Launch a test server with 0 players and unanchored welded parts.
  2. Enter this code in the runbar:
workspace.Part.Position = workspace.Part.Position+Vector3.new(0,0.1,0)
  1. Part teleported to Part2.

weldconstraint bug.rbxl (21.4 KB)

1 Like

Hey all, thanks for the bug reports. With respect to the replies, the change has been reverted, and the server-client issue should be back to normal.

To OP: From my understanding of the repo, the intended behavior should be such that all the models look like the Start Model (redwork) you have shown above, correct? In some sort of dramatic irony, it seems the very change intended to fix OP’s issue has caused some other bugs to pop up. WeldConstraints were not properly handling non-World initializations, so we’ve been working on fixes. Looks like it’s causing some replication issues, though, so we’ll let everyone know as soon as they are addressed.

Thanks for your patience!

7 Likes

Correct! The issue seems to be when parts are not in the workspace.

1 Like

Hey all, especially to @DrWhoInTARDIS, we’ve pushed a recent change that should fix the non-Workspace initialization, as well as avoiding the client - server bugs reported above. Let me know if any outstanding issues occur, however, and we’ll investigate. Thanks everyone!

3 Likes

Some players in my game are reporting to have this issue again. Our doors work based on Weld Constraints and as such, they appear to break often now. This was not an issue when the change was reverted so I’d say it’s safe to assume it’s related to the recent change.

Game:
https://www.roblox.com/games/refer?PlaceId=5041144419

@MetatableIndex do you have an isolated repro? This will help us quickly address the issue.

2 Likes

I haven’t exactly managed to get exact repro steps, but I’ve managed to reproduce it myself both in-game and in a demo place.

By using device emulation, StreamingEnabled on and a local server with more than 3 players, I was able to experience doors becoming stuck and doors appearing in completely random places that don’t really make sense with how they’re scripted / set.

repro weld.rbxl (38.4 KB)

1 Like

Posting this quickly for visibility, this post will be updated as more info comes out from our investigation: I’ve tested locally, and I’m assuming the problem is the following image (the overlapping doors)?

The issue seems to be unrelated to the latest change. I’ve repro-ed on the reverted version, and the behavior in the picture persists. We’ll continue to investigate to see if there might be an actual bug or not. Thanks for the report!

3 Likes

That’s odd. I have no idea what is happening to have that happen; the doors work most of the time, but in some cases they bug out. If the behaviour still occurs on the reverted version then I’m at a loss; this has only started happening again after the new changes were announced / made public so I assumed it’d come from there. (If it’s not then this might still be a bug although unrelated - or, some very rare edge case in how the doors are handled)

Here are some of the things our players have been sending us:

Bug Reports

https://cdn.discordapp.com/attachments/691354922645454878/779443265505460244/Roblox_2020-11-20_15-24-31_Trim.mp4
https://cdn.discordapp.com/attachments/691354922645454878/779454325436710912/3439ffeba79d8ba0d6833a2bbf1a9ada.png
https://cdn.discordapp.com/attachments/691354922645454878/779442540084461628/RobloxScreenShot20201120_152534847.png
https://cdn.discordapp.com/attachments/691354922645454878/779392360677113866/video0.mp4
https://cdn.discordapp.com/attachments/691354922645454878/779383246131298324/unknown.png
https://cdn.discordapp.com/attachments/691354922645454878/779382466158264350/unknown.png
https://cdn.discordapp.com/attachments/691354922645454878/779377593270140958/Roblox_2020-11-20_17-05-50.mp4
https://media.discordapp.net/attachments/691354922645454878/779263763207553054/Screen_Shot_2020-11-20_at_4.34.23_PM.png?width=1083&height=677

Might be related to Streaming?
Some players have also sent us images such as this one: https://media.discordapp.net/attachments/691354922645454878/779346381239484426/RobloxScreenShot20201120_220314683.png?width=1204&height=677

First bug report I can find after the change is from Today at 1:02 AM (20/11/2020 13:02 UTC).

Wanted to round the discussion out a little bit for sake of transparency, so here’s my findings so far:

  1. After looking through your code, I’m curious as to why the parts need to be re-welded? I presume there’s a reason you don’t want to statically weld these parts together. At any rate, however, for the purposes of testing, it doesn’t look like the weldConstraints affect the issue in any way- completely removing the weld and leaving only the animated door frame still results in inconsistent animations. You may want to test for yourself just to confirm, that the movement issue is independent of the welding process, even when there’s no runtime streaming weirdness that can happen to the welds themselves.
  2. Reverting a couple of likely changes this week hasn’t changed anything, either.
  3. Doesn’t mean this isn’t a bug, though. You can try and isolate the problem further, and it might be worthwhile to make a separate post entirely for visibility. Definitely feels like a streaming / animation related problem, if at all. At any rate, if you do happen to find bug dependencies on the WeldConstraints themselves / constraint-related issues, feel free to continue the discussion in this thread. I’ve pinged teams that might know better than I about animations, but regardless it’ll probably be helpful to make a separate, animation/streaming specific report.
3 Likes

I can confirm that WeldConstraint bug has resurfaced in my game. I am not allowed to post my own bug reports, so I will just reply here. As far as I can tell, this issue occurrence is directly connected to this change being pushed and pulled back

I was unable to replicate, but it seems that visual artefacts are visible to specific clients only. When I joined the game everything looked fine to me.

I am welding (via WeldConstraints) non-collidable steps, to the anchored, invisible “ramp”. On the screenshot you can see some steps dropping, even though the ramp has not moved during that time.
It seems that Network ownership is at play, since steps start to drop as soon as player walks on them.

There are also other visual bugs, namely meshes being welded far away from root parts. I am using WeldConstraints for that too. It only happens sometimes and to only some of the clients.

2 Likes

i Can Also Confirm That This Bug Has Resurfaced And Its Really Slowing Down My Work Flow.

In My Screenshot I’m Welding The Steering Wheel And Camera To The Engine But It Has Recalculated This Weird Offset And I Can’t Do Nothing To Prevent This Apart From Making My Own Welding Plugin.

If it’s happening consistently please try to isolate the important parts post a script/repo as it’ll be really helpful for them to fix the issue.
I did some testing and the fix they implemented still seems to work for me. I even tried a local script version of my repo and all is well.

Its Fine Now I Have Made A Simple Weld Plugin, If Anyone Wants To Download It Heres The Plugin Page: Better O Welds - Roblox

Hey all, especially @DrWhoInTARDIS , wanted to give a heads up that we’ve encountered some TeamCreate issues with the latest patch, and will have to revert the fix for the original bug posted here regarding out-of-world weldConstraints.

There’s already a fix to the TeamCreate problem in place, and normally, we’d be able to release that fix - but due to holiday scheduling, this fix probably won’t get in until after the holidays. Sorry about that, this is on us, especially to @DrWhoInTARDIS

Until the fix to both TeamCreate and the non-world initialization is ready to be flipped, I’d suggest a workaround to the above, by trying to avoid having disabled weldConstraints saved or created outside of world / workspace. Only store weldConstraints outside of workspace after having positioned the parts to your liking and enabled.

Thanks again everyone, we’re refactoring quite a bit of legacy code to make the engine more correct and reliable. I appreciate your patience with us as we work through that. We’ll update once all the fixes have been addressed.

UPDATE: The issue should now be resolved. Thanks for waiting, everyone! Let us know if any future issues occur.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.