#How to "Turn Off" a function?
1 messages · Page 1 of 1 (latest)
where it says stopAnim(
remote:FireServer("Block", false)
then you put db = false
oh wait im tripping
pretty sure its the return
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
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
i dont think this is required in this instance
** You are now Level 1! **
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
would that work? The input from the inputBegan and inputEnded are separate
so if I mention the input from inputBegan it wouldn't know what I'm talking about, right?
put this in beginning
local Input
but then it still wouldn't be talking about the input from InputBegan, it would just be a nil variable, right?
if u declare variable at top of script, value change will be detected