Disconnect A Function (Or Stop It From Running) Without Local Function

You can write your topic however you want, but you need to answer these questions:
Hey! I am currently attempting to disconnect a function so that the function only runs when a remote event is fired to the client, but my code has too many changes to try and make the current function

rep.Remotes.eggHatch.OnClientEvent:Connect(function(dt)

a local variable that only happens when you call it later on.
I haven’t found a way to do this yet.
I have asked some scripter friends about this issue, but nobody has any answers.
Is there any other way to stop a function from running again until the remote event gets fired again?
If you could comment down below an example and/or an explanation, that would be helpful.

A easy way of doing this is putting the code from the function into the remote event.

1 Like

I don’t think that’s possible? because if you disconnect the remote listener it obviously won’t detect if someone fired it, but why not try using statements? so it only runs when a specific statement is met? I don’t quite get what you meant.

3 Likes

you could have another remote event specifically for connecting that function

1 Like