Hello! I’m currently working on an event venue and the entrance is supposed to have these flush doors that pop out to expose the main house/audience area. The script I’m using rotates the part back to 0,0,0, when the script has no line that includes rotation. Is anyone able to help?
GIF of what is not supposed to happen and the problem I am having:
https://gyazo.com/fd41ed3e98acd28d386c49ed111f5256
Script:
function tweenModel(model, timee, CF)
enabled = false
local CFrameValue = Instance.new("CFrameValue")
CFrameValue.Value = model:GetPrimaryPartCFrame()
CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
model:SetPrimaryPartCFrame(CFrameValue.Value)
end)
local tween = TweenService:Create(CFrameValue, TweenInfo.new(timee, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Value = CF})
tween:Play()
tween.Completed:Connect(function()
CFrameValue:Destroy()
enabled = true
end)
end
local Ttoggle = false
local Tenabled = true
script.Parent.T.SurfaceGui.TextButton.MouseButton1Click:Connect(function()
if Ttoggle == false and Tenabled == true then
Tenabled = false
Ttoggle = true
tweenModel(script.Parent.OrchestraDoorLeft.DoorLeft, 5, CFrame.new(script.Parent.OrchestraDoorLeft.DoorLeft.Main.Position.X, script.Parent.OrchestraDoorLeft.DoorLeft.Main.Position.Y, script.Parent.OrchestraDoorLeft.DoorLeft.Main.Position.Z - 5))
tweenModel(script.Parent.OrchestraDoorLeft.DoorRight, 5, CFrame.new(script.Parent.OrchestraDoorLeft.DoorRight.Main.Position.X - 1, script.Parent.OrchestraDoorLeft.DoorLeft.Main.Position.Y, script.Parent.OrchestraDoorLeft.DoorRight.Main.Position.Z + 5))
tweenModel(script.Parent.OrchestraDoorRight.DoorLeft, 5, CFrame.new(script.Parent.OrchestraDoorRight.DoorLeft.Main.Position.X, script.Parent.OrchestraDoorRight.DoorLeft.Main.Position.Y, script.Parent.OrchestraDoorRight.DoorLeft.Main.Position.Z - 5))
tweenModel(script.Parent.OrchestraDoorRight.DoorRight, 5, CFrame.new(script.Parent.OrchestraDoorRight.DoorRight.Main.Position.X - 1, script.Parent.OrchestraDoorRight.DoorLeft.Main.Position.Y, script.Parent.OrchestraDoorRight.DoorRight.Main.Position.Z + 5))
tweenModel(script.Parent.Mezzanine1Left.DoorLeft, 5, CFrame.new(script.Parent.Mezzanine1Left.DoorLeft.Main.Position.X, script.Parent.Mezzanine1Left.DoorLeft.Main.Position.Y, script.Parent.Mezzanine1Left.DoorLeft.Main.Position.Z - 5))
tweenModel(script.Parent.Mezzanine1Left.DoorRight, 5, CFrame.new(script.Parent.Mezzanine1Left.DoorRight.Main.Position.X - 1, script.Parent.Mezzanine1Left.DoorLeft.Main.Position.Y, script.Parent.Mezzanine1Left.DoorRight.Main.Position.Z + 5))
tweenModel(script.Parent.Mezzanine1Right.DoorLeft, 5, CFrame.new(script.Parent.Mezzanine1Right.DoorLeft.Main.Position.X, script.Parent.Mezzanine1Right.DoorLeft.Main.Position.Y, script.Parent.Mezzanine1Right.DoorLeft.Main.Position.Z - 5))
tweenModel(script.Parent.Mezzanine1Right.DoorRight, 5, CFrame.new(script.Parent.Mezzanine1Right.DoorRight.Main.Position.X - 1, script.Parent.Mezzanine1Right.DoorLeft.Main.Position.Y, script.Parent.Mezzanine1Right.DoorRight.Main.Position.Z + 5))
tweenModel(script.Parent.Mezzanine2Left.DoorLeft, 5, CFrame.new(script.Parent.Mezzanine2Left.DoorLeft.Main.Position.X, script.Parent.Mezzanine2Left.DoorLeft.Main.Position.Y, script.Parent.Mezzanine2Left.DoorLeft.Main.Position.Z - 5))
tweenModel(script.Parent.Mezzanine2Left.DoorRight, 5, CFrame.new(script.Parent.Mezzanine2Left.DoorRight.Main.Position.X - 1, script.Parent.Mezzanine2Left.DoorLeft.Main.Position.Y, script.Parent.Mezzanine2Left.DoorRight.Main.Position.Z + 5))
tweenModel(script.Parent.Mezzanine2Right.DoorLeft, 5, CFrame.new(script.Parent.Mezzanine2Right.DoorLeft.Main.Position.X, script.Parent.Mezzanine2Right.DoorLeft.Main.Position.Y, script.Parent.Mezzanine2Right.DoorLeft.Main.Position.Z - 5))
tweenModel(script.Parent.Mezzanine2Right.DoorRight, 5, CFrame.new(script.Parent.Mezzanine2Right.DoorRight.Main.Position.X - 1, script.Parent.Mezzanine2Right.DoorLeft.Main.Position.Y, script.Parent.Mezzanine2Right.DoorRight.Main.Position.Z + 5))
wait(5)
Tenabled = true
elseif Ttoggle == true and Tenabled == true then
Tenabled = false
Ttoggle = false
tweenModel(script.Parent.OrchestraDoorLeft.DoorLeft, 5, CFrame.new(script.Parent.OrchestraDoorLeft.DoorLeft.Main.Position.X, script.Parent.OrchestraDoorLeft.DoorLeft.Main.Position.Y, script.Parent.OrchestraDoorLeft.DoorLeft.Main.Position.Z + 5))
tweenModel(script.Parent.OrchestraDoorLeft.DoorRight, 5, CFrame.new(script.Parent.OrchestraDoorLeft.DoorRight.Main.Position.X + 1, script.Parent.OrchestraDoorLeft.DoorLeft.Main.Position.Y, script.Parent.OrchestraDoorLeft.DoorRight.Main.Position.Z - 5))
tweenModel(script.Parent.OrchestraDoorRight.DoorLeft, 5, CFrame.new(script.Parent.OrchestraDoorRight.DoorLeft.Main.Position.X, script.Parent.OrchestraDoorRight.DoorLeft.Main.Position.Y, script.Parent.OrchestraDoorRight.DoorLeft.Main.Position.Z + 5))
tweenModel(script.Parent.OrchestraDoorRight.DoorRight, 5, CFrame.new(script.Parent.OrchestraDoorRight.DoorRight.Main.Position.X + 1, script.Parent.OrchestraDoorRight.DoorLeft.Main.Position.Y, script.Parent.OrchestraDoorRight.DoorRight.Main.Position.Z - 5))
tweenModel(script.Parent.Mezzanine1Left.DoorLeft, 5, CFrame.new(script.Parent.Mezzanine1Left.DoorLeft.Main.Position.X, script.Parent.Mezzanine1Left.DoorLeft.Main.Position.Y, script.Parent.Mezzanine1Left.DoorLeft.Main.Position.Z + 5))
tweenModel(script.Parent.Mezzanine1Left.DoorRight, 5, CFrame.new(script.Parent.Mezzanine1Left.DoorRight.Main.Position.X + 1, script.Parent.Mezzanine1Left.DoorLeft.Main.Position.Y, script.Parent.Mezzanine1Left.DoorRight.Main.Position.Z - 5))
tweenModel(script.Parent.Mezzanine1Right.DoorLeft, 5, CFrame.new(script.Parent.Mezzanine1Right.DoorLeft.Main.Position.X, script.Parent.Mezzanine1Right.DoorLeft.Main.Position.Y, script.Parent.Mezzanine1Right.DoorLeft.Main.Position.Z + 5))
tweenModel(script.Parent.Mezzanine1Right.DoorRight, 5, CFrame.new(script.Parent.Mezzanine1Right.DoorRight.Main.Position.X + 1, script.Parent.Mezzanine1Right.DoorLeft.Main.Position.Y, script.Parent.Mezzanine1Right.DoorRight.Main.Position.Z - 5))
tweenModel(script.Parent.Mezzanine2Left.DoorLeft, 5, CFrame.new(script.Parent.Mezzanine2Left.DoorLeft.Main.Position.X, script.Parent.Mezzanine2Left.DoorLeft.Main.Position.Y, script.Parent.Mezzanine2Left.DoorLeft.Main.Position.Z + 5))
tweenModel(script.Parent.Mezzanine2Left.DoorRight, 5, CFrame.new(script.Parent.Mezzanine2Left.DoorRight.Main.Position.X + 1, script.Parent.Mezzanine2Left.DoorLeft.Main.Position.Y, script.Parent.Mezzanine2Left.DoorRight.Main.Position.Z - 5))
tweenModel(script.Parent.Mezzanine2Right.DoorLeft, 5, CFrame.new(script.Parent.Mezzanine2Right.DoorLeft.Main.Position.X, script.Parent.Mezzanine2Right.DoorLeft.Main.Position.Y, script.Parent.Mezzanine2Right.DoorLeft.Main.Position.Z + 5))
tweenModel(script.Parent.Mezzanine2Right.DoorRight, 5, CFrame.new(script.Parent.Mezzanine2Right.DoorRight.Main.Position.X + 1, script.Parent.Mezzanine2Right.DoorLeft.Main.Position.Y, script.Parent.Mezzanine2Right.DoorRight.Main.Position.Z - 5))
wait(5)
Tenabled = true
end
end)