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

Is there any way to make this script a bit less buggy?

Asked by 9 years ago
function OpenMenu()
    if script.Parent.Parent.Stuff.Visible == false then
        script.Parent.Parent.Stuff.Visible = true
        wait(.01)
        script.Parent.Parent.Stuff:TweenPosition(UDim2.new(0.04, 0,0.3, 0))--{0.9, 0},{-0.1, 0} to {0.04, 0},{0.3, 0}
        script.Parent.Parent.Stuff:TweenSize(UDim2.new(0, 200, 0, 300))--{0, 1},{0, 1} to {0, 200},{0, 300}
    end
end

function CloseMenu()
    if script.Parent.Parent.Stuff.Visible == true then
        script.Parent.Parent.Stuff:TweenPosition(UDim2.new(0.9, 0,-0.1, 0))
        script.Parent.Parent.Stuff:TweenSize(UDim2.new(0, 1, 0, 1))
        wait(0.5)
        script.Parent.Parent.Stuff.Visible = false
    end
end
script.Parent.MouseButton1Down:connect(OpenMenu)
wait(2)
script.Parent.MouseButton1Down:connect(CloseMenu)

Im new at lua scripting and this script just sometimes pop up instead of smoothly tweening

0
I just noticed i have to debug it but idk how supermarioworld323 45 — 9y
0
It's a bad habit to name stuff like "Thingy" and "Stuff". I have no idea what they are supposed to do YellowoTide 1992 — 9y
0
@YellowTide I agree since it could be confusing sometime which is why I normally name my functions variables and so on after the function they do. UserOnly20Characters 890 — 9y
0
I fixed it. supermarioworld323 45 — 9y

Answer this question