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

Using Vector3 on a surfacegui code door, possible?

Asked by 10 years ago

Before i start i just want the viewer(s) to be aware of a couple things. I had coded my own script prior, with only a simple surfacegui. functions of an "open" and "close" button setup. Which worked perfectly fined until a roblox update about 3 weeks ago, resulting in it no longer functioning. No errors were displayed. The script and corresponding door were scrapped. And now i resulted in the use of a Free Model script. It's function; when a user clicks the proper buttons, the door would open.

Now that you have read above, i can get into the issue. I am trying to create a Model that has a Surfacegui setup of buttons. When certain buttons are clicked, it would open. Since im trying to make it a steady opening speed, i am using Vector3. But for some reason, it's not working properly. When i input the code and "ENTER" it, the door just moves a little bit and then stops. No errors are displayed with this issue. I have tried one other alternative, using one big surfacegui. (The current Surfacegui setup is that every button is put into a separate part).

This issue has been lasting awhile and i have no idea what's wrong. Which has lead me to believe that there might be a limitation to using Vector3 with Surfacegui's...

code = "1337" -- Code for keypad
input = "" -- Current input 
output = script.Parent.Printout.SurfaceGui.TextBox
output.Text = "" -- This is the screen above
debounce = 0 --Anti messer upper thingy... don't touch it.

function Clear() -- The Clear button
    input = ""
    output.Text = "Cleared"
    wait(2)
    output.Text = ""
end

script.Parent.Clear.ClickDetector.MouseClick:connect(Clear) --Await for a click.

function Enter()
if debounce <= 0 then -- See if anti messer upper thingy is on or off
    debounce = 1 -- turn the "a.m.u.t." on
    if input == code then -- If the code is correct...
        input = "" --Clear current passcode
        output.TextColor3 = Color3.new(0,1,0) -- Change text color
        output.Text = "Accepted" -- print "Accepted"
    for i= 1,70 do
        script.Parent.Parent.Door.CFrame = script.Parent.Parent.Door.CFrame + Vector3.new(0, 0, 0.20)
        wait(5)
        script.Parent.Parent.Door.CFrame = script.Parent.Parent.Door.CFrame + Vector3.new(0, 0, -0.20)
        output.Text = "" -- clear the text
        output.TextColor3 = Color3.new(1,1,1) --reset the text's color


    return end -- if it's not right then...
        input = ""  -- Agian, clear the inputed code
        output.TextColor3 = Color3.new(1,0,0) -- Set the text's color to red
        output.Text = "Incorrect" -- print out Incorrect
        wait(2) -- Wait a bit.
        output.TextColor3 = Color3.new(1,1,1) --reset colors
        output.Text = ""  -- reset text
    end
    end
    debounce = 0 -- turn off the "a.m.u.t."
end

script.Parent.Enter.ClickDetector.MouseClick:connect(Enter) --Await a click on the enter button

function Click0() --If a mouse clicks '0' then...
    input = input..0 -- add '0' to the end of the current input
    output.Text = output.Text..0 -- add '0' to the end of the screen
    wait(0.1) -- wait a bit so the script does not mess up.
end
script.Parent.C0.ClickDetector.MouseClick:connect(Click0) -- begin to wait for mouse clicks on the '0' button
-- repeat for buttons 1-9
function Click1()
    input = input..1
    output.Text = output.Text..1
    wait(0.1)
end
script.Parent.C1.ClickDetector.MouseClick:connect(Click1)

function Click2()
    input = input..2
    output.Text = output.Text..2
    wait(0.1)
end
script.Parent.C2.ClickDetector.MouseClick:connect(Click2)

function Click3()
    input = input..3
    output.Text = output.Text..3
    wait(0.1)
end
script.Parent.C3.ClickDetector.MouseClick:connect(Click3)

function Click4()
    input = input..4
    output.Text = output.Text..4
    wait(0.1)
end
script.Parent.C4.ClickDetector.MouseClick:connect(Click4)

function Click5()
    input = input..5
    output.Text = output.Text..5
    wait(0.1)
end
script.Parent.C5.ClickDetector.MouseClick:connect(Click5)

function Click6()
    input = input..6
    output.Text = output.Text..6
    wait(0.1)
end
script.Parent.C6.ClickDetector.MouseClick:connect(Click6)

function Click7()
    input = input..7
    output.Text = output.Text..7
    wait(0.1)
end
script.Parent.C7.ClickDetector.MouseClick:connect(Click7)

function Click8()
    input = input..8
    output.Text = output.Text..8
    wait(0.1)
end
script.Parent.C8.ClickDetector.MouseClick:connect(Click8)

function Click9()
    input = input..9
    output.Text = output.Text..9
    wait(0.1)
end
script.Parent.C9.ClickDetector.MouseClick:connect(Click9)

0
Link to door: /www.roblox.com/SG-Door-Proto-item?id=188253846 Darkorbitrocks123 0 — 10y

Answer this question