I’m making an elevator move using TweenService, but only the Floor of the elevator is moving. What I want to happen is for the entire elevator (the “Car” Model) to move as one. I have tried welding the car together, but it didn’t work.
This is the code currently responsible for the movement of the elevator:
function LiftRun(dir)
local LiftFloor = script.Parent.Car.Platform
local TI = TweenInfo.new(
4,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local LiftMove = {CFrame = CFrame.new(LiftFloor.Position.X, script.Parent.Floor:FindFirstChild(script.Parent.Stat.Call.Value).Level.Position.Y, LiftFloor.Position.Z)}
local MoveTween = TW:Create(LiftFloor,TI,LiftMove)
wait(1)
MoveTween:Play()
end
Try using qperfectionWeld,that Quenty has created.(Make sure to read the instructions)
Also select the Elevator model(with Properties tab open) and click at the PrimaryPart propertie,set the PrimaryPart
as the floor.
Did you read the instructions?It says to you anchor it.(Multi-Select all the childrens of the elevator,and anchor all of it)Also you have to put qpw in the elevator model.
You can group all of the elevator parts and make the floor of the elevator the PrimaryPart of the model. TweenService can’t tween models, but there’s a work-around to this:
You’ll have to create a CFrameValue that will be tweened to the floor and the CFrame of the model will be updated in a while loop, or a Stepped event, according to the CFrameValue’s value:
local con
local active = true -- used to see if the tween is still in operation
local CFv = Instance.new("CFrameValue")
CFv.Value = elevator:GetPrimaryPartCFrame()
local LiftMove = {Value = -- new cframe to move to here}
local MoveTween = TW:Create(CFv, TI, LiftMove)
MoveTween.Completed:Connect(function()
active = false
end)
con = game:GetService("RunService").Stepped:Connect(function()
if not active then
CFv:Destroy()
MoveTween:Destroy()
con:Disconnect()
end
ElevatorModel:SetPrimaryPartCFrame(CFv.Value)
end)