Tweening models using WeldConstraints on the client doesn't seem to work

Hello!

I am following the following tutorial:

Anyway for whatever reason, when interacting with the door I rigged using WeldConstraints, it simply does not tween, all of the parts stay in place. The stranger thing is that the hinge part is moving, I just can’t seem to get the door to follow it. I think it may be due to network ownership but how would I go about making the tweens happen locally in order to avoid lag?

Here’s a photo of the door and the WeldConstraints:

As you can see here, the hinge part is moving on the client.

Here are the tweens, it’s in a module so all of the players are able to play the tweens when the client is fired:

module.Function = function()
	if runService:IsClient() then
		if script.Parent:FindFirstChild('IsInteractedWith').Value == false then
			return {
				tweenService:Create(module.Door1Hinge, TweenInfo.new(0.25), {Orientation = module.Door1HingeDestinationOrientation});
				tweenService:Create(module.Door2Hinge, TweenInfo.new(0.25), {Orientation = module.Door2HingeDestinationOrientation});
			}
		else
			return {
				tweenService:Create(module.Door1Hinge, TweenInfo.new(0.25), {Orientation = module.Door1HingeInitialOrientation});
				tweenService:Create(module.Door2Hinge, TweenInfo.new(0.25), {Orientation = module.Door2HingeInitialOrientation});
			}
		end	
	else
		return error('Module function must be called from client!')
	end
end

TIA for any help! :smile:

2 Likes

I had the same problem for a while but managed to get around it using the Easy Weld feature that Moon Animator has. I believe the constraint type is different?

2 Likes

Late response, sorry.

I’ve tried Welds, WeldConstraints and Motor6Ds to no avail.

2 Likes

Are all of the parts unanchored, other than the primary parts?
Also when it moves, do the constraints break?

1 Like

Yep. Only the part that is tweening is anchored. Will check about the constraints breaking.

1 Like

Tried again with WeldConstraints and they remain intact. Tried with Motor6Ds and they remain intact as well. I have also tried tweening it on the server and it didn’t work.

1 Like

Alright that makes it more strange.
As a quick test, would disabling CanCollide and/or enabling Massless help?

I’m wondering if it’s an engine bug or weird physics.

1 Like

I feel like an idiot, I forgot to play the tween on the server and that works. Seems like a network ownership problem. I don’t know how I would go about playing the tween on the client though.

1 Like

Ah, that’s a problem I had for a while.

I ended up making a Tweening Module on the server, and a script with remote events connected to it on the client.
The server fires the remote events telling the client what to do, so it can animate the parts using normal tweening functions, [i also do a check to see if the part exists because… streaming enabled and yeah…] and once the tween should have completed, the server uses :SetPrimaryPartCFrame or something to instantly update for anybody with either: bad connection, or with the part streamed out.

1 Like

This is one of the module’s functions on the server

function module.TweenPart(Part, ToGo, Time)
	Tweening.TweenPart:FireAllClients(Part, ToGo, Time)
	
	local sideScript = coroutine.wrap(function()
		wait(Time)
		Part.CFrame = ToGo
	end)()
end

the client is a really basic tweening script.

1 Like

Right, but I want to keep the tweening on the client in order to avoid any lag/stuttering etc…, is this possible without giving network ownership of the part to the client? The problem seems to be with network ownership because the clients’ constraints won’t work without giving the client network ownership of the model. That’s why the PrimaryPart rotates and the rest of the model doesn’t.

Yes, it seems to work for me,
I have a lot of looping tweens and door animations. I don’t set network ownership, and the doors don’t break despite being welded and being put under a lot of pressure since there’s a lot of physically simulated parts.

Using an instant update on the server is a good backup in case the client fails to tween it.

1 Like

Ah okay, got it. I will try some things out and hopefully everything will go according to plan. Thanks for your help with finding the issue and the recommendations!

1 Like