How to break a function while inside a function?
game.Players.PlayerAdded:Connect(function ( )
How would you break the outer function playerAdded with the touched function?
I want this to be instant, no loops checking it
I do not want to use a while wait(0.001) loop or any high costly loops.
Just return the outer one as well.
u can just assign a variable touched and break the loop when its true
local function epic ( )
local touched = false
touched = true
while wait(0.1) do
if touched == true then
sorry, I miswrote the question, i edited it to be more shaped to how I wanted it
sorry, i reworded the code and question to get the answer I need
Create a book value for if it is touched or not and once it’s touched set it to true. And then below that you check if it is true then break out of the function.
:Disconnect() is what you’re looking for.
lol = Part.Touched:Connect(function()
did not think of that. very nice!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.