I did this:
local ClickDetector = script.Parent.ClickDetector local OPEN = false -- window should be closed when you start the game local Window = script.Parent --this is the window, don't change this since the window is the same as the button local function WindowFunction() if OPEN == false then -- if the window is closed then... for opening = 0, 90, 9 do --this animates the window so it opens wait() Window.CFrame = CFrame.fromEulerAngles(math.rad(opening), 0, 0) end OPEN = true elseif OPEN == true then -- ...but what if the window is open? if so then... for closing = 90, 0, -9 do --this animates the window so it opens wait() Window.CFrame = CFrame.fromEulerAngles(math.rad(closing), 0, 0) end OPEN = false end end ClickDetector.MouseClick:Connect(WindowFunction)
And it doesn't work.