Hello, I am trying to create an animation for a door and I tried to add welds to move the model and not only the part but I have only the “Handle” part which is moving when I click on my door handle.
My script:
local TweenService = game:GetService("TweenService")
local group = workspace.SpawnsPolice.Doors.SpawnDoor
local button = group.DoorHandle.ClickDetector
local doorRoot = group.PrimaryPart
local Start = group.AnimationStart
local End = group.Animation
button.MouseClick:Connect(function()
if doorRoot then
local info = TweenInfo.new(
0.5, -- Time
Enum.EasingStyle.Linear, -- Style
Enum.EasingDirection.Out -- Direction
)
local goal = {}
if doorRoot.Position == End.Position then
goal = {
CFrame = Start.CFrame
}
else
goal = {
CFrame = End.CFrame
}
end
TweenService:Create(doorRoot, info, goal):Play()
else
warn("PrimaryPart undefined.")
end
task.wait(0.7)
end)