Animated Door Help!

Hey! I’m working on a game that needs animated doors. I found an amazing tutorial on YouTube that helped me a lot, but I need to make the door into a double door.

If anyone can help me achieve this it would be greatly appreciated.

2 Likes

make the door, copy and paste it, edit the code a little so when you press the button, then both animations play, boom you have achieved

d o u b l e d o o r

I think you need to use ProximityPrompt | Roblox Creator Documentation and TweenService | Roblox Creator Documentation

There is a good tutorial from colbert2677 that explains how to tween models: Introduction to Tweening Models

1 Like

I didn’t use animations, I just used a attachment.

Thanks! Ive heard that tween is difficult though and I’m pretty new to scripting.

Well that’s an easy script as well, I’ve made it with TweenService because who doesn’t like TweenService, I hope that helps

local Pro = script.Parent.ProximityPrompt -- The ProximityPrompt

local Door = script.Parent -- The door

local TweenService = game:GetService("TweenService") -- Getting The Service
local TweenInformation = TweenInfo.new(1, Enum.EasingStyle.Quad) -- The number is how long it would take to finish the tween, the easingstyle is just the style

local Open = false -- Value

Pro.Triggered:Connect(function() -- If it triggered
	if Open == false then -- If not open then
		Open = true -- Set it to true
		local Tween = TweenService:Create(Door, TweenInformation, {Position = Vector3.new(-45.474, 3.197, -5.269)}) -- Tween Create and you gotta redo the vectors3 bc its on my baseplate
		local Tween2 = TweenService:Create(Door, TweenInformation, {Orientation = Vector3.new(0, -73.38, 0)}) -- redo the vector3 because its on my baseplate
	
		Tween:Play() -- plays
		Tween2:Play() -- plays
	elseif Open == true then -- if its open
		Open = false -- set it to false
		local Tween = TweenService:Create(Door, TweenInformation, {Position = Vector3.new(-47.58, 3.197, -3.04)}) -- redo the vectors
		local Tween2 = TweenService:Create(Door, TweenInformation, {Orientation = Vector3.new(0, 0, 0)}) -- redo the vectors

		Tween:Play() -- play
		Tween2:Play() -- play
	end -- End of if statement
end) -- End of the function
1 Like

Duplicate each side of the door and move it to the position you want the door to be at when it’s open, and name the duplicated parts to “LeftPointA” and “RightPointA” then duplicate each side of the door again and leave it where it is, naming those parts “LeftPointB” and “RightPointB”. Select all of the duplicated parts and turn off CanCollide and set the Transparency to 1. Then, use TweenService to ease the actual door panels from LeftPointB & RightPointB to LeftPointA & RightPointA. Then use wait to create a 3 second delay before the door will repeat the same Tween in reverse to shut the door.

Example:

local tweenservice = game:GetService("TweenService")
local isOpen = false

-- ProximityPrompt Trigger Here
if isOpen == false then
	local doorpanel1 = workspace.door.LeftSide
	local doorpanel2 = workspace.door.RightSide
	local LeftB = workspace.door.LeftPointB
	local RightB = workspace.door.RightPointB
	local LeftA = workspace.door.LeftPointB
	local RightA = workspace.door.RightPointB
	
	local tween1 = tweenservice:Create(doorpanel1,TweenInfo.new(3,Enum.EasingStyle.Linear),{Position = LeftA.Position}):Play()
	local tween2= tweenservice:Create(doorpanel2,TweenInfo.new(3,Enum.EasingStyle.Linear),{Position = RightA.Position}):Play()

	isOpen = true
	
	wait(5)
	
	local tween1 = tweenservice:Create(doorpanel1,TweenInfo.new(3,Enum.EasingStyle.Linear),{Position = LeftB.Position}):Play()
	local tween2= tweenservice:Create(doorpanel2,TweenInfo.new(3,Enum.EasingStyle.Linear),{Position = RightB.Position}):Play()
	
	isOpen = false
end

Let me know if this helps, good luck!
(Please mark this as a solution of this works.)
Just realized I used an incorrect tween here, will fix later if needed.

3 Likes