I tried to make a tween that resizes to one side. Though it did work, I somehow managed to find some bugs that I can’t seem to fix.
Here is the code:
RightCDetect.ClickDetector.MouseClick:Connect(function()
local ClosedSize, OpenSize = RCurtain:GetAttribute("ClosedSize"), RCurtain:GetAttribute("OpenSize")
local OpenAnim = TweenService:Create(RCurtain, TI, {Size = OpenSize, CFrame = RCurtain.CFrame * CFrame.new(2.125 / 2, 0, 0)})
local CloseAnim = TweenService:Create(RCurtain, TI, {Size = ClosedSize, CFrame = RCurtain.CFrame * CFrame.new(-2.125 / 2, 0, 0)})
Folder.Sound:Play()
if RCurtain:GetAttribute("Open") then -- // Close
CloseAnim:Play()
RCurtain:SetAttribute("Open", false)
else -- // Open
OpenAnim:Play()
RCurtain:SetAttribute("Open", true)
end
end)
And this is the bug. I assume it was because I clicked on it multiple times, not giving the tweens time to actually finish and they clash with each other.
https://gyazo.com/9571cad745dd4a21bd158d90a474b966