#How to "Turn Off" a function?

1 messages · Page 1 of 1 (latest)

steel hill
#

im not very good but im pretty sure you put db = false in the block after you turn block to false

#

where it says stopAnim(
remote:FireServer("Block", false)
then you put db = false

#

oh wait im tripping

#

pretty sure its the return

gloomy locust
#

on the inputbegan, replace with:
Input = UIS.InputBegan:Connect(function(input: InputObject, processed: boolean)
and before return line, add this:

    Input:Disconnect()
    Input = nil
end```
#

@steel hill

balmy latch
#

coroutine

#

do coroutin.create to wrap the function you want to stop

#

then when you want to call the function get the created coroutine instance and wrap it with coroutine.resume

#

when you want to close the coroutine wrap the created coroutine with coroutine.close

#

should end the function immediately when called

#

if youre creating a non finite amount of functions make sure to log and close all the coroutines to avoid memory leaks

balmy latch
atomic quiverBOT
#

studio** You are now Level 1! **studio

balmy latch
#

if you intend to delete the UI with the connection make sure to disconnect it also to avoid memory leaks, but again this is off topic not sure what everyone above is talking about

candid delta
#

so if I mention the input from inputBegan it wouldn't know what I'm talking about, right?

gloomy locust
candid delta
#

but then it still wouldn't be talking about the input from InputBegan, it would just be a nil variable, right?

gloomy locust
candid delta
#

lemme try that rq

#

new script, its all messed up somehow