I have a door, and 2 union parts which are the sides that slide out when tweened, but when I try it they still tween to the right position, but just get pushed on top of the door. When I turned off "CanCollide" in all the parts and unions of the door it worked, but it seems it doesn't tween properly when CanCollide is on for everything. But when I have CanCollide off for everything I can walk through it which is an issue.
Gif of CanCollide on for everything (Broken version) https://gyazo.com/a619dcd02ff39a4ccee1003752e518ba
Gif of CanCollide off for everything (Working version)
https://gyazo.com/da21e27fe4783dde54a0658d28ac0a45
And here is the script I use to handle the tweening
local tweenService = game:GetService("TweenService")
local part = script.Parent.Parent.Parent.d1.Union
local part2 = script.Parent.Parent.Parent.d2.Union
local function onCard(hit)
local tweeningInformation = TweenInfo.new(
1,
Enum.EasingStyle.Quint,
Enum.EasingDirection.In,
0,
false,
0
)
local partProperties = {
Position = Vector3.new(-17.311, 3.451, 32.719)
}
local partProperties2 = {
Position = Vector3.new(-10.22, 3.302, 32.719)
}
local Tween = tweenService:Create(part,tweeningInformation,partProperties)
Tween:Play()
local Tween = tweenService:Create(part2,tweeningInformation,partProperties2)
Tween:Play()
end
script.Parent.Touched:Connect(onCard)

1 comment
Thank you for the informative answer, it helped me a lot and the door works with much less code. Also I learned some stuff about moving parts!