Hi,
local tweenService = game:GetService("TweenService") local info = TweenInfo.new() local d1 =script.Parent.Parent:WaitForChild("d1") local d2=script.Parent.Parent:WaitForChild("d2") local info=TweenInfo.new( 0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0 ) local CFrameValue1 = Instance.new("CFrameValue") local CFrameValue2 = Instance.new("CFrameValue") CFrameValue1.Value = d1:GetPrimaryPartCFrame() CFrameValue2.Value = d2:GetPrimaryPartCFrame() local d1open = {Value = CFrame.new(-15.4, 4.5, -23.9)} print(d1open) CFrameValue1:GetPropertyChangedSignal("Value"):Connect(function() d1:SetPrimaryPartCFrame(CFrameValue1.Value) end) CFrameValue2:GetPropertyChangedSignal("Value"):Connect(function() d2:SetPrimaryPartCFrame(CFrameValue1.Value) end) local tween = tweenService:Create(CFrameValue1, info, d1open) script.Parent.ClickDetector.MouseClick:Connect(function() tween:Play() end) --local tween = tweenService:Create(CFrameValue1, info, d1open) --tween:Play() tween.Completed:Connect(function() CFrameValue1:Destroy() end)
https://gyazo.com/55c391583f19141cdbecde5c1921757c
(I'm only using one door at the moment until I can get it working properly) As you can see, the doors orientation rotates to (0,0,0) whereas I do want this to happen, only for the door to slide to the position I've given it. Any idea how I can fix this? Thanks.
I never use SetPrimaryPart for tweening, as I found more reliable way to tween models. There was a tutorial on DevForums, but I will try to summarize it for You. What you do first is create a invisible, anchored "root" part. Then you weld all your parts in model (door in your case) via "Motor6D" welds to that root. Also make sure that other than root, no other part in model is anchored. Last step is to simply use tween on only that root part. To answer Your question, you simply tween "root" Position instead of CFrame. So your line 21 of code will look like this:
local d1open = {Position = Vector3.new(-15.4, 4.5, -23.9)}
And line 32
local tween = tweenService:Create(root, info, d1open) -- "root" means your root part that you have created
I hope this helps...