How do I disconnect the OnClientEvent or Disable it?
local a = true RemoteEvent.OnClientEvent:Connect(function(b) if a == false then :Disconnect(b) end)
The :Connect
method returns a signal object which you can disconnect to disconnect that signal like so:
local a = true local connection connection = RemoteEvent.OnClientEvent:Connect(function(b) if a == false then connection:Disconnect() end end)