Solved - Vault door returning to origin position

Hello. I’m making a vault like Jailbreak Bank one. I got a free model that when you touch it, the vault open, but the problem is. I Don’t know how to make the vault returns to it’s origin position

Here is the code that open the vault.

(The touch trigger is not included. because they are separated scripts).

local One = script.Parent.Dynamite.One

local Two = script.Parent.Dynamite.Two

local Three = script.Parent.Dynamite.Three

local Four = script.Parent.Dynamite.Four

local Five = script.Parent.Dynamite.Five

local Six = script.Parent.Dynamite.Six

local Seven = script.Parent.Dynamite.Seven

local Eight = script.Parent.Dynamite.Eight

One.Transparency = 1

Two.Transparency = 1

Three.Transparency = 1

Four.Transparency = 1

Five.Transparency = 1

Six.Transparency = 1

Seven.Transparency = 1

Eight.Transparency = 1

repeat

wait()

until

script.Parent.Open.Value == true

One.Transparency = 0

wait(2)

Two.Transparency = 0

wait(2)

Three.Transparency = 0

wait(2)

Four.Transparency = 0

wait(2)

Five.Transparency = 0

wait(2)

Six.Transparency = 0

wait(2)

Seven.Transparency = 0

wait(2)

Eight.Transparency = 0

for count = 0,-0.04,-0.001 do

script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame() * CFrame.fromEulerAnglesXYZ(0, count, 0))

wait()

end

for count = -0.04,0,0.001 do

script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame() * CFrame.fromEulerAnglesXYZ(0, count, 0))

wait()

end

This might help. Tho I don’t exactly know how you’re making the doors move you can set another part (which is the closed door original CFrame) and after an amount of time the door will go back to it’s original CFrame by going back to the part’s CFrame.

Just See The Code, It’s moved by SetPrimaryPartCFrame but i don’t know what numbers i put instead of for count = 0, -0.04, -0.001 do to close the vault.


Think of it like this^^
The transparent part is another part that is the doors original CFrame. The actual moving door is referencing off that part and using that part to know where to move to.

Try using this when you want the vault to close

for count = 0, 0.04, 0.001 do

	script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame() *CFrame.fromEulerAnglesXYZ(0, count, 0))
	wait()

end

for count = 0.04, 0, -0.001 do

	script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame() *CFrame.fromEulerAnglesXYZ(0, count, 0))
	wait()

end
1 Like