Ok so I’m trying to use [Tweenservice+(TweenService Plus+ [Update V1.1]) which I’m using to tween a model
Whole Script (Still working on the script)
local Elevator = script.Parent:WaitForChild("Elevator")
local Floors = script.Parent:WaitForChild("Floors")
local CurrentFloor = 1
local DoorOpenTime = 3
local Running = false
local Globle = require(game:GetService("ReplicatedStorage").Game.Modules.Globle)
local TweenModule = Globle.Common.TweenModule
local function Doors(i)
if i == "Close" then
Elevator.SoundPart.Door:Play()
if CurrentFloor == 1 then
TweenModule:Create(Floors.Floor1.Doors.DoorL.DoorL, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Floors.Floor1.Doors.DoorL.Org.CFrame}):Play()
TweenModule:Create(Floors.Floor1.Doors.DoorR.DoorR, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Floors.Floor1.Doors.DoorR.Org.CFrame}):Play()
task.wait(.50)
TweenModule:Create(Elevator.Doors.DoorL.DoorL, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Elevator.Doors.DoorL.Org.CFrame}):Play()
TweenModule:Create(Elevator.Doors.DoorR.DoorR, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Elevator.Doors.DoorR.Org.CFrame}):Play()
elseif CurrentFloor == 2 then
TweenModule:Create(Floors.Floor2.Doors.DoorL.DoorL, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Floors.Floor2.Doors.DoorL.Org.CFrame}):Play()
TweenModule:Create(Floors.Floor2.Doors.DoorR.DoorR, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Floors.Floor2.Doors.DoorR.Org.CFrame}):Play()
task.wait(.50)
TweenModule:Create(Elevator.Doors.DoorL.DoorL, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Elevator.Doors.DoorL.Org.CFrame}):Play()
TweenModule:Create(Elevator.Doors.DoorR.DoorR, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Elevator.Doors.DoorR.Org.CFrame}):Play()
end
elseif i == "Open" then
Elevator.SoundPart.Ding:Play()
Elevator.SoundPart.Door:Play()
if CurrentFloor == 1 then
TweenModule:Create(Floors.Floor1.Doors.DoorL.DoorL, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Floors.Floor1.Doors.DoorL.GoTo.CFrame}):Play()
TweenModule:Create(Floors.Floor1.Doors.DoorR.DoorR, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Floors.Floor1.Doors.DoorR.GoTo.CFrame}):Play()
task.wait(.50)
TweenModule:Create(Elevator.Doors.DoorL.DoorL, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Elevator.Doors.DoorL.GoTo.CFrame}):Play()
TweenModule:Create(Elevator.Doors.DoorR.DoorR, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Elevator.Doors.DoorR.GoTo.CFrame}):Play()
elseif CurrentFloor == 2 then
TweenModule:Create(Floors.Floor2.Doors.DoorL.DoorL, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Floors.Floor2.Doors.DoorL.GoTo.CFrame}):Play()
TweenModule:Create(Floors.Floor2.Doors.DoorR.DoorR, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Floors.Floor2.Doors.DoorR.GoTo.CFrame}):Play()
task.wait(.50)
TweenModule:Create(Elevator.Doors.DoorL.DoorL, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Elevator.Doors.DoorL.GoTo.CFrame}):Play()
TweenModule:Create(Elevator.Doors.DoorR.DoorR, TweenInfo.new(DoorOpenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Elevator.Doors.DoorR.GoTo.CFrame}):Play()
end
end
end
Doors("Open")
local function ChangeFloor(i)
if i == 1 then
Running = true
Doors("Close")
task.wait(5)
TweenModule:Create(Elevator, TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Floors.Floor1.GoTo.CFrame}):Play()
task.wait(6)
CurrentFloor = 1
Doors("Open")
Running = false
Floors.Floor1.Call.Button.Material = Enum.Material.SmoothPlastic
Elevator.F1.Button.Material = Enum.Material.SmoothPlastic
elseif i == 2 then
Running = true
Doors("Close")
task.wait(5)
TweenModule:Create(Elevator, TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {CFrame = Floors.Floor2.Goto.CFrame}):Play()
task.wait(6)
CurrentFloor = 2
Doors("Open")
Running = false
Floors.Floor2.Call.Button.Material = Enum.Material.SmoothPlastic
Elevator.F2.Button.Material = Enum.Material.SmoothPlastic
end
end
Floors.Floor1.Call.Button.Click.MouseClick:Connect(function()
if CurrentFloor == 2 and Running == false then
Floors.Floor1.Call.Button.Material = Enum.Material.Neon
Elevator.F1.Button.Material = Enum.Material.Neon
ChangeFloor(1)
end
end)
Elevator.F1.Button.Click.MouseClick:Connect(function()
if CurrentFloor == 2 and Running == false then
Floors.Floor1.Call.Button.Material = Enum.Material.Neon
Elevator.F1.Button.Material = Enum.Material.Neon
ChangeFloor(1)
end
end)
Floors.Floor2.Call.Button.Click.MouseClick:Connect(function()
if CurrentFloor == 1 and Running == false then
Floors.Floor2.Call.Button.Material = Enum.Material.Neon
Elevator.F2.Button.Material = Enum.Material.Neon
ChangeFloor(2)
end
end)
Elevator.F2.Button.Click.MouseClick:Connect(function()
if CurrentFloor == 1 and Running == false then
Floors.Floor2.Call.Button.Material = Enum.Material.Neon
Elevator.F2.Button.Material = Enum.Material.Neon
ChangeFloor(2)
end
end)
while task.wait() do
Elevator.Number.Text.SurfaceGui.SIGN.Text = CurrentFloor
end