Tweenservice on model problem

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)

image

1 Like

You sure the welds are correct?

Yeah; the part0 is set on Handle and part1 to Window and DoorHandle

The main Part you are tweening has to be Anchored.
Weld everything else to it and make those Parts Unanchored.

If you need to make the handle animated later on and you have multiple Parts in the Handle then weld those Parts just to the handle.

In the Model tab, select “Show Welds” to show you where your welds are. I’ve mistakenly welded a door part to the baseplate on a few occasions.


https://gyazo.com/8eb107f0b20111885893e1890da0eb5d

But the welds are Grey which means they are attached to an Anchored Part.

Are the window and the door itself Anchored is what I was asking.

Are you tweening the Handle as the local doorRoot = group.PrimaryPart? This means the handle must be set as the PrimaryPart for the SpawnDoor model.

image


I found the problem :), thanks I had just to remove “Anchored” to window & door handle.

So the first 2 lines of my first post?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.