How To Make Tween Service For Model With Primary Part Please ?
I have test with :SetPrimaryPartCFrame but doesn't work
My code is :
-- door 1 and door 2 are on the same model -- open = script.Parent.Parent.Parent.open lock = script.Parent.Parent.Parent.lock open.Value = false door1 = script.Parent.Parent.Parent.Parent.Door1 door2 = script.Parent.Parent.Parent.Parent.Door2 local TweenService = game:GetService("TweenService") local part = script.Parent local tweenInfo = TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0) local Door1Open = {CFrame = door1.CFrame + door1.CFrame:vectorToWorldSpace(Vector3.new(0,0,-8))} local Door2Open = {CFrame = door2.CFrame + door2.CFrame:vectorToWorldSpace(Vector3.new(0,0,-8))} local Door1Close = {CFrame = door1.CFrame } local Door2Close = {CFrame = door2.CFrame } local Open1 = TweenService:Create(door1,tweenInfo,Door1Open) local Open2 = TweenService:Create(door2,tweenInfo,Door2Open) local Close1 = TweenService:Create(door1,tweenInfo,Door1Close) local Close2 = TweenService:Create(door2,tweenInfo,Door2Close) script.Parent.MouseClick:connect(function() if open.Value == false and lock.Value == false then script.Parent.Parent.Parent.Button1.BrickColor = BrickColor.new("Lime green") script.Parent.Parent.Parent.Button2.BrickColor = BrickColor.new("Lime green") Open1:Play() Open2:Play() open.Value = true elseif open.Value == true and lock.Value == false then script.Parent.Parent.Parent.Button1.BrickColor = BrickColor.new("Really red") script.Parent.Parent.Parent.Button2.BrickColor = BrickColor.new("Really red") Close1:Play() Close2:Play() open.Value = false elseif open.Value == true and lock.Value == true then script.Parent.Parent.Parent.Button1.BrickColor = BrickColor.new("Really red") script.Parent.Parent.Parent.Button2.BrickColor = BrickColor.new("Really red") Close1:Play() Close2:Play() open.Value = false end end)
I didn't try it yet but with a bit of research I found someone who found a solution
local tweenService = game:GetService("TweenService") local info = TweenInfo.new() local function tweenModel(model, CF) local CFrameValue = Instance.new("CFrameValue") CFrameValue.Value = model:GetPrimaryPartCFrame() CFrameValue:GetPropertyChangedSignal("Value"):Connect(function() model:SetPrimaryPartCFrame(CFrameValue.Value) end) local tween = tweenService:Create(CFrameValue, info, {Value = CF}) tween:Play() tween.Completed:Connect(function() CFrameValue:Destroy() end) end
If you want to read the forum click here
Don't work my script :
open = false script.Parent.Parent.Parent.DoorAll.PrimaryPart = script.Parent.Parent.Parent.DoorAll.Door1 door1 = script.Parent.Parent.Parent.DoorAll local TweenService = game:GetService("TweenService") local part = script.Parent local tweenInfo = TweenInfo.new(10,Enum.EasingStyle.Quint,Enum.EasingDirection.Out,0,false,0) local Door1Open = {CFrame = door1:SetPrimaryPartCFrame(door1:GetPrimaryPartCFrame() * CFrame.Angles(0,0,0))} local Door1Close = {CFrame = door1.CFrame } local Open1 = TweenService:Create(door1,tweenInfo,Door1Open) local Close1 = TweenService:Create(door1,tweenInfo,Door1Close) script.Parent.MouseClick:connect(function() if open == false then Open1:Play() wait(2) open = true else Close1:Play() wait(2) open = false end end)