Animation not Playing on Opening Closet

Hi!

So I was trying to make a closet hiding system like doors. (But bad)

And the closet opening works, but the animation doesn’t… so basically the closet doesn’t open.

Here’s the script:

local TweenServ = game:GetService("TweenService")

local door1 = script.Parent.Door1
local hinge1 = script.Parent.Hinge1
local prompt = script.Parent.Door1.ProximityPrompt

local goalOpen = {}
goalOpen.CFrame = hinge1.CFrame * CFrame.Angles(0, math.rad(90), 0)

local goalClose = {}
goalClose.CFrame = hinge1.CFrame * CFrame.Angles(0,0,0)

local tweenInfo = TweenInfo.new(0.5)
local tweenOpen = TweenServ:Create(hinge1, tweenInfo, goalOpen
local tweenClose = TweenServ:Create(hinge1, tweenInfo, goalClose)

prompt.Triggered:Connect(function()
    if prompt.ActionText == "Close" then
       tweenClose:Play()
      prompt.ActionText = "Open"
else
     tweenOpen:Play()
     prompt.ActionText = "Close"
     end
end)

Mb in line 14 you forgot to put the bracket

I used your code and adjusted it to my door and it works

Hello, can you be more specific on whats the problem in your code?

also a possible problem is that you anchored the door itself but you only need to anchor the hinge

1 Like

Basically, when the prompt is triggered, the closet opens or closes depending on it’s state.
The output says that the door is opening and closing, but the animation which actually shows the door opening doesn’t work. So the closet is basically useless.

Wow… that was the problem. Oh yeah, btw the actual code has the missing bracket, I just forgot it trying to copy it onto here, the ctrl-c+ctrl-v didn’t work.
Ty!

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