Hello devs! So I’m working on my horror game and there needs to be drawers, but they miss something, they don’t hold items, this is my code :
local ts = game:GetService("TweenService")
local handle = script.Parent.Interactive
local doorOpen = false
local sound = script.Parent.Interactive.DrawerSound
local open = ts:Create(handle,TweenInfo.new(0.15,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{
CFrame = handle.CFrame * CFrame.new(handle.CFrame.RightVector * -2.1)
})
local close = ts:Create(handle,TweenInfo.new(0.15,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{
CFrame = handle.CFrame
})
handle.ClickDetector.MouseClick:Connect(function(player, part)
if doorOpen == true then
sound:Play()
close:Pause()
open:Play()
doorOpen = false
else
sound:Play()
open:Pause()
close:Play()
doorOpen = true
end
end)