Is there a way to reconnect a function after disconnecting it?

Yes. That could be any event in a game. For example a player leaving or dying. Some examples of common events that are used a lot in games are as follows.

game:GetService("RunService").RenderStepped -- Event used for running code every frame in a localscript
RemoteEvent.OnServerEvent -- Event used for receiving actions from player that need to have a serverwide effect e.g. player fires a bullet from a gun (you decide when to fire this event) client->server
Humanoid.Died -- Event used when a Character dies

To note all these events can be found on the documentation. There are many more events it can be daunting but learning the main ones and you will see the patterns.

example in a script

local playerJoined = game:GetService("Players").PlayerAdded:Connect(function(player)
    print("Player",player.Name,"has joined.")
end)

For more I recommend you scan through this if you haven’t