Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How To Make Tween Service For Model With Primary Part ?

Asked by 6 years ago

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)
0
If you use tweenservice you should better just union everything User#20388 0 — 6y
0
yes but union don't work with window transparency ramirezdu06 0 — 6y
0
Why would you move a window?? User#20388 0 — 6y
0
no window door with window ramirezdu06 0 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

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

0
How to place it ? i place this in the script and i group all door in model but doesn't work ? Picture : https://image.noelshack.com/fichiers/2018/17/5/1524833797-pic1.png ramirezdu06 0 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

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)

Answer this question