Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I made a window in the game it doesn't work, Can someone help me?

Asked by 6 years ago

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.

0
Hey, is that in a localscript or script? What is it parented to? Is the connect ever being called (test by putting a print statement at the start of WindowFunction)? Brouhahaha 27 — 6y
0
It's a script, It's parented to "Window" atomdiamondpure1 0 — 6y
0
You can try to figure out the location of the problem - with the Connect, or with the function, by putting print statements to see if that is ever executed. If it's not executed the the function doesn't matter, because it's never being reached. Brouhahaha 27 — 6y

Answer this question