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

Tween won't work and has no errors?

Asked by 2 years ago

My Door Tween Is not opening when it functions, I have no errors!

There is a left door and a right door and both of them are unanchored but they both have a weld attachment that welds to a primary part

My code

local this = script.Parent

local TweenService = game:GetService("TweenService")

local TrainDoor = this.Carriage.TrainDoor
local Event = this.OpenDoors

local doortweenInfo = TweenInfo.new(1, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false, 0)

function Doors(v)
    if v.Name == "DoorL" then
        print("DoorL")
        TweenService:Create(v, doortweenInfo, {CFrame = v.PosOpen.CFrame}):Play()
        print("Opened")
        delay(5, function()
        TweenService:Create(v, doortweenInfo, {CFrame = v.PosClosed.CFrame}):Play()
        end)
        print("Closed")
    end
    if v.Name == "DoorR" then
        print("DoorR")
        TweenService:Create(v, doortweenInfo, {CFrame = v.PosOpen.CFrame}):Play()
        print("Opened")
        delay(5, function()
        TweenService:Create(v, doortweenInfo, {CFrame = v.PosClosed.CFrame}):Play()
        end)
        print("Closed")
    end
end
Event.Event:Connect(function()
    for i,v in pairs(TrainDoor:GetChildren()) do
        print("Activated!!")
        Doors(v)
    end 
end)

Answer this question