How would I be able to make this elevator tween down? This is what I want it to look like: (sorry its a bit unclear)
And this is my script:
local TweenService = game:GetService("TweenService")
local TOP_DOOR = script.Parent.Parent.Parent.Doors.TOP_DOOR
local SIDE_DOOR = script.Parent.Parent.Parent.Doors.SIDE_DOOR
local ELEVATOR = script.Parent.Parent.Parent
local goal = {}
goal.Position = Vector3.new(5.35, -29.75, -46.05)
local goaltwo = {}
goaltwo.Position = Vector3.new(5.35, -21.75, -46.05)
local goalthree = {}
goalthree.Position = Vector3.new(-1.15, -29.45, -46.05)
local elevatordowngoal = {}
elevatordowngoal.Position = Vector3.new(-1.15, -29.45, -46.05)
local elevatorupgoal = {}
elevatorupgoal.Position = Vector3.new(2.15, -25.65, -48.95)
local tweenInfo = TweenInfo.new(5)
-- Close
local tween1 = TweenService:Create(TOP_DOOR, tweenInfo, goal)
local tween2 = TweenService:Create(SIDE_DOOR, tweenInfo, goal)
-- Open
local tween3 = TweenService:Create(TOP_DOOR, tweenInfo, goaltwo)
local tween4 = TweenService:Create(SIDE_DOOR, tweenInfo, goalthree)
-- Elevator Movement
local elevatortweendown = TweenService:Create(ELEVATOR, tweenInfo, elevatordowngoal) -- DOWN
local elevatortweenup = TweenService:Create(ELEVATOR, tweenInfo, elevatorupgoal) -- UP
script.Parent.ProximityPrompt.Triggered:Connect(function()
tween1:Play() -- Close first door (TOP)
wait(3)
tween2:Play() -- Close second door (SIDE)
wait(3)
elevatortweendown:Play() -- Move down
wait(1)
tween4:Play() -- Open first door (TOP)
wait(1)
tween3:Play() -- Open second door (SIDE)
wait(6)
tween1:Play() -- Close first door (TOP)
wait(3)
tween2:Play() -- Close second door (SIDE)
elevatortweenup:Play() -- Move up
wait(3)
tween4:Play() -- Open second door (SIDE)
wait(1)
tween3:Play() -- Open first door (TOP)
end)
can you explain what you’re having issues with, is it that you can’t tween the entire model or getting the right position. Can you be a bit more specific about what your issue is
You can use the MoveTo() function on a Model to move it up and down.
local goal = {}
goal.Position = Vector3.new(5.35, -29.75, -46.05)
local goaltwo = {}
goaltwo.Position = Vector3.new(5.35, -21.75, -46.05)
local goalthree = {}
goalthree.Position = Vector3.new(-1.15, -29.45, -46.05)
local elevatordowngoal = {}
elevatordowngoal.Position = Vector3.new(-1.15, -29.45, -46.05)
local elevatorupgoal = {}
elevatorupgoal.Position = Vector3.new(2.15, -25.65, -48.95)
local tweenInfo = TweenInfo.new(5)
-- Close
local tween1 = TweenService:Create(TOP_DOOR, tweenInfo, goal)
local tween2 = TweenService:Create(SIDE_DOOR, tweenInfo, goal)
-- Open
local tween3 = TweenService:Create(TOP_DOOR, tweenInfo, goaltwo)
local tween4 = TweenService:Create(SIDE_DOOR, tweenInfo, goalthree)
-- Elevator Movement
local elevatortweendown = TweenService:Create(ELEVATOR, tweenInfo, elevatordowngoal) -- DOWN
local elevatortweenup = TweenService:Create(ELEVATOR, tweenInfo, elevatorupgoal) -- UP
script.Parent.ProximityPrompt.Triggered:Connect(function()
tween1:Play() -- Close first door (TOP)
wait(3)
tween2:Play() -- Close second door (SIDE)
wait(3)
elevatortweendown:Play() -- Move down
wait(1)
tween4:Play() -- Open first door (TOP)
wait(1)
tween3:Play() -- Open second door (SIDE)
wait(6)
tween1:Play() -- Close first door (TOP)
wait(3)
tween2:Play() -- Close second door (SIDE)
elevatortweenup:Play() -- Move up
wait(3)
tween4:Play() -- Open second door (SIDE)
wait(1)
tween3:Play() -- Open first door (TOP)
end)
I believe that is the example also I forgot to add the
local TweenService = game:GetService("TweenService")
local TOP_DOOR = script.Parent.Parent.Parent.Doors.TOP_DOOR
local SIDE_DOOR = script.Parent.Parent.Parent.Doors.SIDE_DOOR
local ELEVATOR = script.Parent.Parent.Parent
The moveto() function takes two arguments: the x-coordinate and the y-coordinate of the destination. For example, to move the elevator to the point (4,2), you would use the following code:
local TweenService = game:GetService("TweenService")
local TOP_DOOR = script.Parent.Parent.Parent.Doors.TOP_DOOR
local SIDE_DOOR = script.Parent.Parent.Parent.Doors.SIDE_DOOR
local ELEVATOR = script.Parent.Parent.Parent
local goal = {}
goal.Position = Vector3.new(5.35, -29.75, -46.05)
local goaltwo = {}
goaltwo.Position = Vector3.new(5.35, -21.75, -46.05)
local goalthree = {}
goalthree.Position = Vector3.new(-1.15, -29.45, -46.05)
local elevatordowngoal = {}
elevatordowngoal.Position = MoveTo(4,2) -- huh?
local elevatorupgoal = {}
elevatorupgoal.Position = MoveTo(4,2) -- huh?
local tweenInfo = TweenInfo.new(5)
-- Close
local tween1 = TweenService:Create(TOP_DOOR, tweenInfo, goal)
local tween2 = TweenService:Create(SIDE_DOOR, tweenInfo, goal)
-- Open
local tween3 = TweenService:Create(TOP_DOOR, tweenInfo, goaltwo)
local tween4 = TweenService:Create(SIDE_DOOR, tweenInfo, goalthree)
-- Elevator Movement
local elevatortweendown = TweenService:Create(ELEVATOR, tweenInfo, elevatordowngoal) -- DOWN
local elevatortweenup = TweenService:Create(ELEVATOR, tweenInfo, elevatorupgoal) -- UP
script.Parent.ProximityPrompt.Triggered:Connect(function()
tween1:Play() -- Close first door (TOP)
wait(3)
tween2:Play() -- Close second door (SIDE)
wait(3)
elevatortweendown:Play() -- Move down
wait(1)
tween4:Play() -- Open first door (TOP)
wait(1)
tween3:Play() -- Open second door (SIDE)
wait(6)
tween1:Play() -- Close first door (TOP)
wait(3)
tween2:Play() -- Close second door (SIDE)
elevatortweenup:Play() -- Move up
wait(3)
tween4:Play() -- Open second door (SIDE)
wait(1)
tween3:Play() -- Open first door (TOP)
end)
I believe you remove the tween3:Play() and replace it with the moveto() function. And in the moveto() you would place the cordinates the elevator would move to.
local TweenService = game:GetService("TweenService")
local TOP_DOOR = script.Parent.Parent.Parent.Doors.TOP_DOOR
local SIDE_DOOR = script.Parent.Parent.Parent.Doors.SIDE_DOOR
local ELEVATOR = script.Parent.Parent.Parent
local goal = {}
goal.Position = Vector3.new(5.35, -29.75, -46.05)
local goaltwo = {}
goaltwo.Position = Vector3.new(5.35, -21.75, -46.05)
local goalthree = {}
goalthree.Position = Vector3.new(-1.15, -29.45, -46.05)
local elevatordowngoal = {}
elevatordowngoal.Position = Vector3.new(-1.15, -29.45, -46.05)
local elevatorupgoal = {}
elevatorupgoal.Position = Vector3.new(2.15, -25.65, -48.95)
local tweenInfo = TweenInfo.new(5)
-- Close
local tween1 = TweenService:Create(TOP_DOOR, tweenInfo, goal)
local tween2 = TweenService:Create(SIDE_DOOR, tweenInfo, goal)
-- Open
local tween3 = TweenService:Create(TOP_DOOR, tweenInfo, goaltwo)
local tween4 = TweenService:Create(SIDE_DOOR, tweenInfo, goalthree)
script.Parent.ProximityPrompt.Triggered:Connect(function()
tween1:Play() -- Close first door (TOP)
wait(3)
tween2:Play() -- Close second door (SIDE)
wait(3)
MoveTo(-1.15, -29.45, -46.05)
wait(1)
tween4:Play() -- Open first door (TOP)
wait(1)
tween3:Play() -- Open second door (SIDE)
wait(6)
tween1:Play() -- Close first door (TOP)
wait(3)
tween2:Play() -- Close second door (SIDE)
MoveTo(2.15, -25.65, -48.95)
wait(3)
tween4:Play() -- Open second door (SIDE)
wait(1)
tween3:Play() -- Open first door (TOP)
end)
Both of the MoveTo() functions are underlined in red and say: Unknown Global MoveTo()
-- this allows models to be tweened using a cframe value
local function tweenModel(model: Model, cframe: CFrame)
-- this is a value that can be tweened it's impossible to tween model directly
local cframeValue = Instance.new("CFrameValue")
-- this is the tween that move the cframevalue to the goal
local tween = TweenService:Create(cframeValue, tweenInfo, {
Value = cframe,
})
-- this event update every time the cframevalue update which means we get a tween-like look
local conn; conn = cframeValue.Changed:Connect(function(value)
model:PivotTo(value) -- we want to move to the position the cframevalue is at
end)
-- once finished we don't want to use it again so we have to cleanup
tween.Completed:Once(function()
conn:Disconnect()
cframeValue:Destroy()
end)
tween:Play() -- play the cframevalue tween which will start updating the model
end
So I just checked again and I believe that the moveto() function is actually updated so you need to use Model:PivotTo() I believe that this is correct, I don’t exactly know. @TeamDreams123