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

How do i break functions?

Asked by 10 years ago

I want to end a function if you press a GUI while its running. how would i do that?

    Skip = Instance.new("TextButton",ScrnGui)
    SKip.MouseButton1Down:connect(function()
--??
    end)

2 answers

Log in to vote
1
Answered by 10 years ago

Use return.

Skip = Instance.new("TextButton",ScrnGui)
Running = false
Skip.MouseButton1Down:connect(function()
    if Running then
        return
    end
    Running = true

    --Your Code Here

    Running = false
end)
Ad
Log in to vote
-1
Answered by 10 years ago
break

Answer this question