Why can't I tween a model with a weld?

So, I’m working on an escape room and I scripted a key code chest. Once it’s correct, the tween on the red brick should rotate and pull the top of the chest top open on the hinge. I used a qPerfection welding script on the top of the chest so it should work as it was planned. However, when I test the game in-studio, the red brick tweens and rotates itself without taking the unanchored welded model with it when it’s clearly welded to a welded model top. This used to work fine, but now, I’m not sure what to do. I don’t want to use hinges because they will cause more lag in the game. So, I plan on used tweeting for doors, chests, lockboxes, safes, vaults, etc… If you have any info, it would be greatly appreciated and it’ll help a lot. Thanks! :smiley:

Here’s also my script for the Tween:

local RS = game:GetService("ReplicatedStorage")
local RF = RS:WaitForChild("AlexDormRoom"):WaitForChild("LockBoxes"):WaitForChild("VaultzChest1")
local TS = game:GetService("TweenService")

--Functions--
RF.OnServerInvoke = function(player, codeEntered)
	local MotorAxis = game.Workspace:WaitForChild("Alex's Room").VaultzLockChest.Motor
	local goal = {}
	goal.Orientation = Vector3.new(-75, -90, 0)

	local tInfo = TweenInfo.new(
		1.5,
		Enum.EasingStyle.Linear,
		Enum.EasingDirection.Out,
		1,
		false,
		0
	)
	local tween = TS:Create(MotorAxis, tInfo, {Orientation = Vector3.new(-75, -90, 0)})

	if codeEntered == '7264' then
		tween:Play()
		
		
		return true
	
		
		else
		return false
	end
end

why cant i move something that is glued to the floor? You would need to explictly tween it with its .Position property

This should be able to work since the position never changes in the script. If I did change the position of the other parts, then they would all just go to the position which is deforming the shape of the top of the lock-chest.

Why don’t you use a WeldConstraint for the weld instead.

There’s way too many parts to weld together since it’s too detailed.

Common mistake is to Tween models/welded parts using Orientation or Position.

Only use CFrame when tweening multiple parts together. Tweening Position or Orientation will break welds.

2 Likes

Yeah, I haven’t learned Cframe as much as tweening, so I’m not sure how to do that yet. But that’s something I’ll look into.

It’s not difficult, below is the CFrame equivalent of your goal orientation

local goalCFrame = CFrame.new(MotorAxis.Position) * CFrame.Angles(math.rad(-75), math.rad(-90), 0))
1 Like
CFrame = {MotorAxis.CFrame * CFrame.Angles(math.rad(-75),math.rad(-90),0)
}

don’t forget to weld all parts to MotorAxis and Anchor = false all your parts except main part(MortorAxis)

make mortoraxis be PrimaryPart of model