local heartBeatConnection
Player.CharacterAdded:Connect(function(character)
heartBeatConnection = RunService.Heartbeat:Connect(function()
print("idk")
end)
end)
Player.CharacterRemoving:Connect(function()
if heartBeatConnection then
heartBeatConnection:Disconnect()
heartBeatConnection = nil
end
end)
It’s really no different. But it depends on what he is using this for, if the connection needs to be disconnected on death, then yeah, but if it needs to be disconnected and reconnected on respawn, the code I provided works best.
True, but I wouldn’t do either method on the client side, as you can simply connect it forever (keep a reference to it if you wanna disconnect it later, and check if the player’s character is there or not (it will probably be there since it isn’t destroyed on death) and it is very quickly destroyed and recreated when the respawn sequence occurs.
Though my opinion is irrelevant as you already provided OP with a solution